[issue41532] Import precedence is broken in some library

2020-08-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is because module functools is already imported (you can see it in 
sys.modules), but module tokenize is not. It is likely due to module 
rlcompleter imported at startup on Linux, but not on Windows.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread Jinseo Kim


Jinseo Kim  added the comment:

My environment is Ubuntu 18.04.4

Python version:
  Python 3.8.0 (default, Oct 28 2019, 16:14:01)
  [GCC 8.3.0] on linux

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread Irit Katriel


Irit Katriel  added the comment:

What is your environment - system and python version?

I get this on master checkout on windows 10:

Running Release|Win32 interpreter...
Python 3.10.0a0 (heads/master:46e19b61d3, Aug 12 2020, 18:02:36) [MSC v.1916 32 
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> with open('functools.py', 'w') as f:
...  f.write("print('This is so sad')")
...
23
>>> import linecache
This is so sad
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\User\src\cpython\lib\linecache.py", line 11, in 
import tokenize
  File "C:\Users\User\src\cpython\lib\tokenize.py", line 32, in 
import re
  File "C:\Users\User\src\cpython\lib\re.py", line 315, in 
@functools.lru_cache(_MAXCACHE)
AttributeError: module 'functools' has no attribute 'lru_cache'
>>> quit()
C:\Users\User\src\cpython>del functools.py

C:\Users\User\src\cpython>python
Running Release|Win32 interpreter...
Python 3.10.0a0 (heads/master:46e19b61d3, Aug 12 2020, 18:02:36) [MSC v.1916 32 
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> with open('tokenize.py', 'w') as f:
...  f.write("print('This is so sad')")
...
23
>>> import linecache
This is so sad
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread Jinseo Kim


Jinseo Kim  added the comment:

Yes, I restarted and cleared directory before each test.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread Irit Katriel


Irit Katriel  added the comment:

Did you restart python before the functools test?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41532] Import precedence is broken in some library

2020-08-12 Thread 김진서

New submission from 김진서 :

I found this behavior by chance:

  >>> with open('tokenize.py', 'w') as f:
  ...   f.write("print('This is so sad')")
  ...
  >>> import linecache
  This is so sad
  >>>

  path/of/python/Lib/linecache.py:
import functools
import sys
import os
import tokenize

[...]

Meanwhile,

  >>> with open('functools.py', 'w') as f:
  ... f.write("print('This is so sad')")
  ...
  >>> import linecache
  >>>

It seems for me to be broken: 'import' doesn't have clear precedence.

--
components: Library (Lib)
messages: 375262
nosy: contact
priority: normal
severity: normal
status: open
title: Import precedence is broken in some library
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com