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

Commite832631

Browse files
Check attrs in m_copy.
1 parentc5aced3 commite832631

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎Lib/test/test_imp.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ def clean_up():
294294
if lookedup is not _testsinglephase:
295295
raise Exception((_testsinglephase, lookedup))
296296
297+
# Attrs set in the module init func are in m_copy.
298+
_initialized = _testsinglephase._initialized
299+
initialized = _testsinglephase.initialized()
300+
if _initialized != initialized:
301+
raise Exception((_initialized, initialized))
302+
297303
# Attrs set after loading are not in m_copy.
298304
if hasattr(_testsinglephase, 'spam'):
299305
raise Exception(_testsinglephase.spam)

‎Modules/_testsinglephase.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ init_module(PyObject *module, module_state *state)
134134
if (PyModule_AddObjectRef(module,"str_const",state->str_const)!=0) {
135135
return-1;
136136
}
137+
138+
doubled=_PyTime_AsSecondsDouble(state->initialized);
139+
PyObject*initialized=PyFloat_FromDouble(d);
140+
if (initialized==NULL) {
141+
return-1;
142+
}
143+
if (PyModule_AddObjectRef(module,"_initialized",initialized)!=0) {
144+
return-1;
145+
}
146+
137147
return0;
138148
}
139149

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp