| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| } | ||
| return ( // -1 if any remaining symbols are NULL | ||
| return // -1 if any remaining symbols are NULL | ||
| ((TK_FIND_PHOTO = (Tk_FindPhoto_t) |
There was a problem hiding this comment.
I think it would be clearer if these were a bunch of separate ifs instead of this long chained thing (if every assignment fit on one line, that would also be clearer.)
Sorry, something went wrong.
There was a problem hiding this comment.
That'll be much simpler to do after #10680 is merged and we later get to remove the old version of the API. Then the only functions we'll have to load are Tk_FindPhoto and Tk_PhotoPutBlock_NoComposite, which also means that the Windows and non-Windows versions will only need to differ by how they call _dfunc.
Not convinced it's worth changing for now.
Sorry, something went wrong.
There was a problem hiding this comment.
Just to be clear, the endgame is to just do (e.g.)
void *_dfunc(void *lib_handle, const char *func_name);
int _func_loader(void *lib)
{
// Fill global function pointers from dynamic lib.
// Return number of successfully loaded functions.
#define LOAD_TK(name) tk::name = Tk_##name##_t(_dfunc(lib, "Tk_" #name))
return bool(LOAD_TK(FindPhoto)) + bool(LOAD_TK(PhotoPutBlock_NoComposite));
#undef LOAD_TK
}
followed by OS-specific versions of _dfunc.
Sorry, something went wrong.
There was a problem hiding this comment.
#10680 is merged now.
Sorry, something went wrong.
There was a problem hiding this comment.
But the old API is still around (the simplification will only come after matplotlib.backends.tkagg is completely removed).
Sorry, something went wrong.
| found_tcl = get_tcl(hMods[i]); | ||
| if (found_tcl == -1) { | ||
| return 1; | ||
| return; |
There was a problem hiding this comment.
What error is set here instead?
Sorry, something went wrong.
There was a problem hiding this comment.
good catch... fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually no, there is indeed an error being set by _dfunc()
void *_dfunc(void *lib_handle, const char *func_name)
{
// Load function `func_name` from `lib_handle`.
// Set Python exception if we can't find `func_name` in `lib_handle`.
// Returns function pointer or NULL if not present.
void* func;
// Reset errors.
dlerror();
func = dlsym(lib_handle, func_name);
if (func == NULL) {
PyErr_SetString(PyExc_RuntimeError, dlerror()); // here
}
return func;
}
(and similarly on Windows).
Left the original version as is.
Sorry, something went wrong.
| found_tk = get_tk(hMods[i]); | ||
| if (found_tk == -1) { | ||
| return 1; | ||
| return; |
There was a problem hiding this comment.
Or here?
Sorry, something went wrong.
| // Return 1 if any pointer is NULL, 0 otherwise. | ||
| return ( | ||
| return | ||
| ((TCL_CREATE_COMMAND = (Tcl_CreateCommand_t) |
There was a problem hiding this comment.
Same split up here, probably.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
(just making it quite a bit shorter...)
PR Checklist