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

gh-81057: Move the Remaining Import State Globals to _PyRuntimeState#99488

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Add _PyRuntime.imports.find_and_load.
  • Loading branch information
@ericsnowcurrently
ericsnowcurrently committedNov 14, 2022
commit7472eb440ae1a66b13e9fc8b5ebf90967dbf10fe
5 changes: 5 additions & 0 deletionsInclude/internal/pycore_import.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,11 @@ struct _import_runtime_state {
unsigned long thread;
int level;
} lock;
struct {
int import_level;
_PyTime_t accumulated;
int header;
} find_and_load;
};


Expand Down
3 changes: 3 additions & 0 deletionsInclude/internal/pycore_runtime_init.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,6 +45,9 @@ extern "C" {
.thread = PYTHREAD_INVALID_THREAD_ID, \
.level = 0, \
}, \
.find_and_load = { \
.header = 1, \
}, \
}, \
.global_objects = { \
.singletons = { \
Expand Down
9 changes: 6 additions & 3 deletionsPython/import.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1759,8 +1759,8 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
PyObject *mod = NULL;
PyInterpreterState *interp = tstate->interp;
int import_time = _PyInterpreterState_GetConfig(interp)->import_time;
static intimport_level;
static _PyTime_taccumulated;
#define import_level _PyRuntime.imports.find_and_load.import_level
#define accumulated _PyRuntime.imports.find_and_load.accumulated

_PyTime_t t1 = 0, accumulated_copy = accumulated;

Expand All@@ -1781,12 +1781,13 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
* _PyDict_GetItemIdWithError().
*/
if (import_time) {
static intheader= 1;
#defineheader_PyRuntime.imports.find_and_load.header
if (header) {
fputs("import time: self [us] | cumulative | imported package\n",
stderr);
header = 0;
}
#undef header

import_level++;
t1 = _PyTime_GetPerfCounter();
Expand DownExpand Up@@ -1816,6 +1817,8 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
}

return mod;
#undef import_level
#undef accumulated
}

PyObject *
Expand Down
3 changes: 0 additions & 3 deletionsTools/c-analyzer/cpython/globals-to-fix.tsv
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -368,7 +368,6 @@ Python/dtoa.c-p5s-
Python/fileutils.c-_Py_open_cloexec_works-
Python/fileutils.c-force_ascii-
Python/fileutils.cset_inheritableioctl_works-
Python/import.cimport_find_and_loadheader-

#-----------------------
# unlikely to change after init (or main thread)
Expand DownExpand Up@@ -430,8 +429,6 @@ Python/bootstrap_hash.c-urandom_cache-
Python/ceval_gil.cmake_pending_callsbusy-
Python/ceval.c_PyEval_SetProfilereentrant-
Python/ceval.c_PyEval_SetTracereentrant-
Python/import.cimport_find_and_loadaccumulated-
Python/import.cimport_find_and_loadimport_level-
Python/modsupport.c-_Py_PackageContext-
Python/thread_pthread_stubs.h-py_tls_entries-
Python/pyfpe.c-PyFPE_counter-
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp