Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add C API for importing an attribute from a module #93741

Closed
Labels
@serhiy-storchaka

Description

@serhiy-storchaka

It is common (more than 30 cases) in the C code to access a function or a variable from other module. For example:

functools=PyImport_ImportModule("functools");if (!functools)        gotoerror;st->partial=PyObject_GetAttrString(functools,"partial");Py_CLEAR(functools);

I propose to add a private helper function which combinesPyImport_ImportModule() andPyObject_GetAttrString().

st->partial=_PyImport_GetModuleAttrString("functools","partial");

It will save 4-6 lines of code and a variable on every use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp