Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-30 Thread Serhiy Storchaka

On 30.10.15 03:22, Terry Reedy wrote:

Leaving IDLE aside, the reason '' is added to sys.path is so that people
can import their own modules.  This is very useful.  Shadowing is the
result of putting it at the front.  I have long thought this a dubious
choice.  If '' were instead appended, people could still import modules
that did not duplicate stdlib names.  Anyone who wanted shadowing could
move '' to the front.  But then shadowing would be intentional, not an
accident.


LGTM.

AFAIK the sys module can't be shadowed.

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-30 Thread Nathaniel Smith
On Oct 29, 2015 6:26 PM, "Terry Reedy"  wrote:
>
> On 10/29/2015 11:59 AM, Laura Creighton wrote:
>>
>>
>> see the following:
>> lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py
>> lac@smartwheels:~/junk$ idle-python3.5
>> hello there
>> Traceback (most recent call last):
>>File "", line 1, in 
>>File "/usr/lib/python3.5/idlelib/run.py", line 10, in 
>>  from idlelib import CallTips
>>File "/usr/lib/python3.5/idlelib/CallTips.py", line 16, in 
>>  from idlelib.HyperParser import HyperParser
>>File "/usr/lib/python3.5/idlelib/HyperParser.py", line 14, in 
>>  _ASCII_ID_CHARS = frozenset(string.ascii_letters + string.digits +
"_")
>> AttributeError: module 'string' has no attribute 'ascii_letters'
>>
>> IDLE then produces a popup that says:
>>
>> IDLE's subprocess didn't make connection.  Either IDLE can't stat a
subprocess por personal firewall software is blocking the connection. 
>>
>> 
>>
>> I think that life would be a whole lot easier for people if instead we
got
>> a message:
>>
>> Warning: local file /u/lac/junk/string.py shadows module named string in
the
>> Standard Library
>>
>> I think that it is python exec that would have to do this -- though of
>> course the popup could also warn about shadowing in general, instead of
>> sending people on wild goose chases over their firewalls.
>>
>> Would this be hard to do?
>
>
> Leaving IDLE aside, the reason '' is added to sys.path is so that people
can import their own modules.  This is very useful.  Shadowing is the
result of putting it at the front.  I have long thought this a dubious
choice.  If '' were instead appended, people could still import modules
that did not duplicate stdlib names.  Anyone who wanted shadowing could
move '' to the front.  But then shadowing would be intentional, not an
accident.

Unfortunately I think that (among other things) there are a lot of scripts
out there that blindly do sys.path.pop(0) to remove the "" entry, so the
backcompat costs of changing this would probably be catastrophic.

-n
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Python tracker Issues

2015-10-30 Thread Python tracker

ACTIVITY SUMMARY (2015-10-23 - 2015-10-30)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open5204 (+23)
  closed 32073 (+30)
  total  37277 (+53)

Open issues with patches: 2298 


Issues opened (37)
==

#25467: Put “deprecated” warnings first
http://bugs.python.org/issue25467  opened by Tony R.

#25468: PyTraceBack_Print()/_Py_DisplaySourceLine() should take custom
http://bugs.python.org/issue25468  opened by shiz

#25469: multiprocessing .Condition.notify(_all) function has O(N) time
http://bugs.python.org/issue25469  opened by vilnis.termanis

#25470: Random Malloc error raised
http://bugs.python.org/issue25470  opened by augustin rieunier

#25472: Typing: Specialized subclasses of generics cannot be unpickled
http://bugs.python.org/issue25472  opened by maatt

#25474: Weird behavior when setting f_trace in a context manager
http://bugs.python.org/issue25474  opened by Fred Gansevles

#25476: close() behavior on non-blocking BufferedIO objects with socke
http://bugs.python.org/issue25476  opened by dabeaz

#25477: text mode for pkgutil.get_data
http://bugs.python.org/issue25477  opened by Antony.Lee

#25478: Consider adding a normalize() method to collections.Counter()
http://bugs.python.org/issue25478  opened by rhettinger

#25479: Increase unit test coverage for abc.py
http://bugs.python.org/issue25479  opened by szymon

#25481: PermissionError in subprocess.check_output() when an inaccessi
http://bugs.python.org/issue25481  opened by jaystrict

#25482: signal.set_wakeup_fd() doesn't work if the signal don't have h
http://bugs.python.org/issue25482  opened by ishimoto

#25483: Improve f-string implementation: FORMAT_VALUE opcode
http://bugs.python.org/issue25483  opened by eric.smith

#25485: Add a context manager to telnetlib.Telnet
http://bugs.python.org/issue25485  opened by desbma

#25486: Resurrect inspect.getargspec() in 3.6
http://bugs.python.org/issue25486  opened by yselivanov

#25487: imp module DeprecationWarning in test suite
http://bugs.python.org/issue25487  opened by martin.panter

#25488: IDLE: Remove idlelib from sys.path when added
http://bugs.python.org/issue25488  opened by terry.reedy

#25489: sys.exit() caught in exception handler
http://bugs.python.org/issue25489  opened by jinty

#25491: ftplib.sendcmd only accepts string
http://bugs.python.org/issue25491  opened by wozlaf

#25492: subprocess with redirection fails after FreeConsole
http://bugs.python.org/issue25492  opened by George Prekas

#25493: warnings.warn: wrong stacklevel causes import of local file "s
http://bugs.python.org/issue25493  opened by bevan

#25495: binascii documentation incorrect
http://bugs.python.org/issue25495  opened by mouse07410

#25496: tarfile: Default value for compresslevel is not documented
http://bugs.python.org/issue25496  opened by Sworddragon

#25497: Rewrite test_robotparser
http://bugs.python.org/issue25497  opened by berker.peksag

#25498: Python 3.4.3 core dump with simple sample code
http://bugs.python.org/issue25498  opened by JakeMont

#25500: docs claim __import__ checked for in globals, but IMPORT_NAME 
http://bugs.python.org/issue25500  opened by superbobry

#25505: undefined name 'window' in Tools/scripts/fixdiv.py
http://bugs.python.org/issue25505  opened by John.Mark.Vandenberg

#25507: IDLE: user code 'import tkinter; tkinter.font' should fail
http://bugs.python.org/issue25507  opened by terry.reedy

#25508: LogRecord attributes are not tuple, when logging only dict
http://bugs.python.org/issue25508  opened by sejvlond

#25509: PyImport_ImportModule inaccurately described
http://bugs.python.org/issue25509  opened by memeplex

#25510: fileinput.FileInput.readline() always returns str object at th
http://bugs.python.org/issue25510  opened by Ryosuke Ito

#25511: multiprocessing pool blocks SIGTERM from being handled
http://bugs.python.org/issue25511  opened by djones

#25514: better startup error messages in IDLE when stdlib modules shad
http://bugs.python.org/issue25514  opened by markroseman

#25516: threading.Condition._is_owned() is wrong when using threading.
http://bugs.python.org/issue25516  opened by nirs

#25517: regex howto example in "Lookahead Assertions"
http://bugs.python.org/issue25517  opened by Pavel

#25518: Investigate implementation of PyOS_CheckStack on OSX
http://bugs.python.org/issue25518  opened by ronaldoussoren

#25519: Minor difflib documentation bug
http://bugs.python.org/issue25519  opened by lurchman



Most recent 15 issues with no replies (15)
==

#25519: Minor difflib documentation bug
http://bugs.python.org/issue25519

#25518: Investigate implementation of PyOS_CheckStack on OSX
http://bugs.python.org/issue25518

#25511: multiprocessing pool blocks SIGTERM from being handled
http://bugs.python.org/issue25511

#25505: undefined name 'window' in Tools/sc

Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-30 Thread Terry Reedy

On 10/30/2015 3:21 AM, Serhiy Storchaka wrote:


AFAIK the sys module can't be shadowed.


I tried it and it seems to be true of builtins in general.


--
Terry Jan Reedy

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-30 Thread Brett Cannon
On Fri, 30 Oct 2015 at 21:42 Terry Reedy  wrote:

> On 10/30/2015 3:21 AM, Serhiy Storchaka wrote:
>
> > AFAIK the sys module can't be shadowed.
>
> I tried it and it seems to be true of builtins in general.
>

The importer on sys.meta_path that handles built-ins is earlier than the
one that handles sys.path (technically you can shadow them if you changed
sys.meta_path).
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

2015-10-30 Thread Serhiy Storchaka

On 30.10.15 09:57, Nathaniel Smith wrote:

Unfortunately I think that (among other things) there are a lot of
scripts out there that blindly do sys.path.pop(0) to remove the ""
entry, so the backcompat costs of changing this would probably be
catastrophic.


You are right. There are too much occurrences even in public libraries.

https://code.openhub.net/search?s=%22sys.path.pop(0)%22&p=0

Possible workaround is to add fake path (or a duplicate of system path) 
at the start of sys.path. Then dropping first element will not break the 
script.



___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com