Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymodule: tidy up module init #1630

Merged
merged 2 commits into from
May 26, 2021
Merged

pymodule: tidy up module init #1630

merged 2 commits into from
May 26, 2021

Conversation

davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented May 25, 2021

Three small tweaks:

  • Remove PyModuleDef_INIT symbol.
  • Set module __doc__ via m_doc def member rather than with a setattr() call.
  • Don't bother calling ffi::PyEval_InitThreads() - as far as I can tell this isn't necessary (even on Python 3.6).

@@ -312,14 +321,8 @@ impl ModuleDef {
#[cfg(not(Py_3_7))]
ffi::PyEval_InitThreads();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a unsafe block here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I don't think this call to PyEval_InitThreads is needed at all. Pushed a commit to remove it, and updated the OP.

@davidhewitt davidhewitt force-pushed the module-init branch 2 times, most recently from 85092f0 to 3e87ea3 Compare May 25, 2021 21:51
Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants