Skip to content

GH-69695: Update documentation for PyImport_ImportModule #103700

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

Closed
wants to merge 1 commit into from
Closed

GH-69695: Update documentation for PyImport_ImportModule #103700

wants to merge 1 commit into from

Conversation

patenaud
Copy link
Contributor

@patenaud patenaud commented Apr 22, 2023

@ghost
Copy link

ghost commented Apr 22, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

import of a module doesn't leave the module in :data:`sys.modules`.

This function always uses absolute imports.
This is a wrapper around :c:func:`PyImport_Import()` which takes a ``const char *`` as an argument instead of a ``PyObject *``.
Copy link
Member

Choose a reason for hiding this comment

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

You could maybe use c:expr syntax here?

@patenaud patenaud closed this by deleting the head repository Apr 24, 2023
@arhadthedev
Copy link
Member

@patenaud If you deleted your clone by mistake, you can create a new PR after recreation.

@patenaud
Copy link
Contributor Author

patenaud commented Apr 24, 2023 via email

@arhadthedev
Copy link
Member

From 47f3a71b48ac6fd8b98e6d35abe3d9c3462a1bc0 Mon Sep 17 00:00:00 2001
From: Denis Patenaude <denis.patenaude@gmail.com>
Date: Sat, 22 Apr 2023 18:23:59 -0400
Subject: [PATCH] Update documentation for PyImport_ImportModule

---
 Doc/c-api/import.rst | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index a51619db6d3d..e72fd84bbfac 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -13,19 +13,7 @@ Importing Modules
       single: __all__ (package variable)
       single: modules (in module sys)
 
-   This is a simplified interface to :c:func:`PyImport_ImportModuleEx` below,
-   leaving the *globals* and *locals* arguments set to ``NULL`` and *level* set
-   to 0.  When the *name*
-   argument contains a dot (when it specifies a submodule of a package), the
-   *fromlist* argument is set to the list ``['*']`` so that the return value is the
-   named module rather than the top-level package containing it as would otherwise
-   be the case.  (Unfortunately, this has an additional side effect when *name* in
-   fact specifies a subpackage instead of a submodule: the submodules specified in
-   the package's ``__all__`` variable are  loaded.)  Return a new reference to the
-   imported module, or ``NULL`` with an exception set on failure.  A failing
-   import of a module doesn't leave the module in :data:`sys.modules`.
-
-   This function always uses absolute imports.
+   This is a wrapper around :c:func:`PyImport_Import()` which takes a ``const char *`` as an argument instead of a ``PyObject *``.
 
 
 .. c:function:: PyObject* PyImport_ImportModuleNoBlock(const char *name)

@patenaud
Copy link
Contributor Author

patenaud commented Apr 25, 2023 via email

@patenaud
Copy link
Contributor Author

Done. Newbie. Let me know if I could have done something better.

@arhadthedev
Copy link
Member

arhadthedev commented Apr 25, 2023

Newbie.

Rather not. When GitHub gives no warning that the deletion affects some open PRs, it begs for troubles sooner or later.

@AA-Turner
Copy link
Member

New PR: #103836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants