>     I notice some modules not in modules directory(for example: 
> _warnings、marshal in python directory). Do we need port those modules to 
> modules directory?

I strongly suspect the answer is "no." Modules which aren't in the
Modules directory are built directly into the Python executable. Using
your example of the _warnings module, note that in Makefile.pre.in
Python/_warnings.o is listed in the PYTHON_OBJS list (as are
Python/sysmodule.o and Python/marshal.o). This is evidence they are
built directly into the interpreter itself. Another is that at runtime
those modules have no __file__ attribute:

>>> import marshal
>>> marshal.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'marshal' has no attribute '__file__'
>>> import sys
>>> sys.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sys' has no attribute '__file__'
>>> import _warnings
>>> _warnings.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module '_warnings' has no attribute '__file__'

Skip
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/U4Q622G32XJGIXUMIW3V7QPKMHK7PEEV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to