@@ -3499,12 +3499,20 @@ class Sub(tp):
34993499 pass
35003500 self .assertEqual (_testcapi .pytype_getmodulebytoken (Sub , token ), module )
35013501
3502- @requires_gil_enabled ("empty slots re-enable GIL" )
35033502 def test_from_modexport_empty_slots (self ):
3503+ # Module to test that Py_mod_abi is mandatory for PyModExport
3504+ modname = '_test_from_modexport_empty_slots'
3505+ filename = _testmultiphase .__file__
3506+ with self .assertRaises (SystemError ):
3507+ import_extension_from_file (
3508+ modname , filename , put_in_sys_modules = False )
3509+
3510+ @requires_gil_enabled ("this module re-enables GIL" )
3511+ def test_from_modexport_minimal_slots (self ):
35043512 # Module to test that:
3505- # - no slots are mandatory for PyModExport
3513+ # - no slots except Py_mod_abi is mandatory for PyModExport
35063514 # - the slots array is used as the default token
3507- modname = '_test_from_modexport_empty_slots '
3515+ modname = '_test_from_modexport_minimal_slots '
35083516 filename = _testmultiphase .__file__
35093517 module = import_extension_from_file (
35103518 modname , filename , put_in_sys_modules = False )
@@ -3516,7 +3524,7 @@ def test_from_modexport_empty_slots(self):
35163524 smoke_mod = import_extension_from_file (
35173525 '_test_from_modexport_smoke' , filename , put_in_sys_modules = False )
35183526 self .assertEqual (_testcapi .pymodule_get_token (module ),
3519- smoke_mod .get_modexport_empty_slots ())
3527+ smoke_mod .get_modexport_minimal_slots ())
35203528
35213529@cpython_only
35223530class TestMagicNumber (unittest .TestCase ):
0 commit comments