FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use _testlimitedcapi in test_free_threading.test_capi by vstinner · Pull Request #158935 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 4 additions & 5 deletions Lib/test/test_free_threading/test_capi.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import ctypes.util
import sys
import unittest

from test.support import import_helper
from test.support import threading_helper
from test.support.threading_helper import run_concurrently


@ctypes.util.wrap_dll_function(ctypes.pythonapi)
def PyImport_AddModuleRef(name: ctypes.c_char_p) -> ctypes.py_object:
pass
# Skip the test if the extension is missing
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')


@threading_helper.requires_working_threading()
Expand All @@ -20,6 +18,7 @@ def test_pyimport_addmoduleref_thread_safe(self):
NUM_ITERS = 10
NTHREADS = 4

PyImport_AddModuleRef = _testlimitedcapi.PyImport_AddModuleRef
module_name = f"test_free_threading_addmoduleref_{id(self)}"
module_name_bytes = module_name.encode()
sys.modules.pop(module_name, None)
Expand Down
Loading

Back | FazBrowse Home | New Git URL