GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-105699: Use a Linked List for the PyModuleDef Cache by ericsnowcurrently · Pull Request #106899 · python/cpython Conversation
| |||||||||||||||||||||||||||||||||||||||||||||||
| _PyInterpreterState_Main()); | ||
| /* The lock is initialized directly with the general runtime state. */ | ||
| assert(EXTENSIONS.mutex != NULL); | ||
| //assert(EXTENSIONS.head == NULL); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Leftover line I presume.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sort of. I had expected the assert to work (and it would in a simpler world). I was going to circle back to it but, having slept on it, don't see the need. It can be dropped.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -919,167 +919,134 @@ extensions_lock_release(void) | |||
| static void | |||
| _extensions_cache_init(void) | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why have this function at all, now that it's just a single assert?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I figured I'd end up finding a better solution than a linked list that would revive the need for this function, so I kept it around. The point is a bit moot now though. 😄
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyErr_NoMemory(); | ||
| goto finally; | ||
| } | ||
| strcpy(cached->filename, PyUnicode_AsUTF8(filename)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use strncpy to avoid the deprecation in some compilers (macOS IIRC?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| res = 0; | ||
|
|
||
| /* Destroy the cache data. */ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this DECREF found->def ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
good catch
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Understood. I was looking for a quick fix and mostly played a hunch that the performance impact would be minimal. I don't think I'm wrong but agree there isn't enough time to properly validate my hypothesis. Thanks for speaking up. I do plan on finding an alternative that doesn't rely on a Python object, to address the crasher. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.