[issue37993] os.path.realpath on Windows resolves mapped network drives

2019-08-31 Thread Steve Dower


Steve Dower  added the comment:

And thanks for reporting this, Christoph. Issue37834 (and some of the issues 
linked from there) is where we had most of the discussion about this change.

--

___
Python tracker 

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



[issue37993] os.path.realpath on Windows resolves mapped network drives

2019-08-31 Thread Steve Dower


Steve Dower  added the comment:

Is this an issue or a mismatched expectation?

Tests that assume realpath() on Windows is the equivalent of abspath() are of 
course going to fail when we fix realpath(), and that's kind of what this one 
looks like. Just because it doesn't have a direct Unix equivalent doesn't mean 
that any particular behavior is any better.

> Unix Python resolves the executable path with repeated _Py_wreadlink calls. 
> Windows Python should do something similar to ensure the consistency of 
> sys.executable with realpath(sys.executable).

I don't think this necessarily follows. There's nowhere in the documentation 
that says that sys.executable is even a valid path, let alone the final path.

> I think we want relpath(realpath('C:/Temp/foo'), realpath('S:/')) to succeed 
> as r"..\foo". I don't think we want it to fail as a cross-drive relative path.

Cross-drive relative paths are fine though - they are just absolute paths :)

>  The documentation refers to symbolic links and junctions, which are 
> different from mapped network and subst drives (AFAIU).

If we can easily tell the difference between directory junctions and mapped 
drives, given that they are both identical types of reparse points, then we can 
make readlink() only read directory junctions. I need a specific algorithm for 
telling the difference though, not just lists of examples of things that 
"should" work (without any rationale for why they ought to work).

--

___
Python tracker 

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



[issue37981] Can't install Python 3.7.4 x64 on Win 8.1

2019-08-31 Thread Steve Dower


Steve Dower  added the comment:

Your 3.7.1 install is for all users, and you're trying to install 3.7.4 just 
for yourself.

This is supposed to work, so I'm not sure why it isn't. I haven't had time to 
look more closely, but if you are able to install for all users (by going 
through the "Custom" install button) or uninstall 3.7.1 first, you should be 
fine.

--

___
Python tracker 

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



[issue37997] Segfault when using pickle with exceptions and dynamic class inheritance

2019-08-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Anthony Sottile


Anthony Sottile  added the comment:

neat, this looks like a similar api to astpretty: 
https://github.com/asottile/astpretty

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve

2019-08-31 Thread Laurent Gautier


Laurent Gautier  added the comment:

Bump.

Is there anything I could do to move this forward (as in write and submit a 
patch for review) ?

--

___
Python tracker 

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



[issue37997] Segfault when using pickle with exceptions and dynamic class inheritance

2019-08-31 Thread Gabriel C


New submission from Gabriel C :

The following results in a segfault on 3.7.4 (running on macOS high sierra) and 
3.5 (running on ubuntu 16.04). It does not happen in python 2.7.

The problem seems to involve two effects. The first is the creation of a class 
with a dynamic type that inherits from a MemoryError (but any exception will 
work). The second is pickling an instance of that MemoryError (note that the 
dynamic type is never pickled).

If a basic (non-exception) class is used instead of the MemoryError (see 
uncomment case 1), then the segfault does not occur in my testing. If the 
exception being pickled is a different type to the one used as the base class 
for the dynamic type, the segfault does not occur. 

Note that unpickling the MemoryError actually raises another exception, this 
raised exception (see uncomment case 2) is raised by the dynamic type class 
__init__ method. It seems that in trying to unpickle the MemoryError, pickle 
attempts to create an instance of the unrelated dynamic type instead. Examining 
the stack trace (uncomment case 3), shows the raised exception is indeed 
originating from attempting to unpickle the MemoryError.

The segfault does not happen immediately, but instead after several attempts. 
It can happen after as few as 5 attempts or as many as 100. 

```
import pickle

def CreateDynamicClass(basetype):
class DynamicClassImpl(basetype):
def __init__(self):
super(DynamicClassImpl, self).__init__()

return DynamicClassImpl()

class TestClass(object):
pass

N_attemps = 1000

pickle_list = []

def load_list():
for i in range(N_attemps):
test_exception = MemoryError("Test" + str(i))
#test_exception = TestClass() # Uncomment case 1
pickle_list.append(pickle.dumps(test_exception))
load_list()

def unload_list():
for i in range(N_attemps):
try:
test_object_instance = pickle.loads(pickle_list.pop())
test_dynamic_object = CreateDynamicClass(MemoryError)
#test_dynamic_object = CreateDynamicClass(TestClass) # Uncomment 
case 1
except Exception as e:
print("Exception at iteration {}: {}".format(i, e)) # Uncomment 
case 2
#raise # Uncomment case 3
pass
unload_list()
```

--
components: Library (Lib)
messages: 350932
nosy: gabrielc
priority: normal
severity: normal
status: open
title: Segfault when using pickle with exceptions and dynamic class inheritance
type: crash
versions: Python 3.5, Python 3.7

___
Python tracker 

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



[issue37992] Change datetime.MINYEAR to allow for negative years

2019-08-31 Thread Tim Peters


Tim Peters  added the comment:

This just isn't going to happen.  There's no agreement to be had.  For example, 
the proleptic Gregorian calendar _does_ have a "year 0", and so also does ISO 
8601.

Version 1.0 of the XML schema spec did not have a year 0, but _claimed_ to be 
compatible with ISO 8601 - which it wasn't in this respect.  So version 1.1 
added year 0, despite then being incompatible with version 1.0 of itself in 
this respect[1].

> I am not sure that adding this feature would be worth
> the support burden it would bring.

I am:  it wouldn't ;-)  

[1] https://en.wikipedia.org/wiki/Astronomical_year_numbering

--
nosy: +tim.peters

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Bob Kline


Bob Kline  added the comment:

In fact, I suppose it's possible that the warning as I worded it is still not 
restrictive enough, and that there are subtle dependencies between the fixers 
which would make the action of one of them render the code no longer safely 
fixable as Python 2 code by the other fixers, and the real warning should 
really say something like, "You can only run this tool once in write-in-place 
mode on a given code set. You can run as many times without the -w option as 
many times, with as many combinations of fixers as you want, determining which 
of the fixers you will enable for the final write-in-place run." Are there such 
dependencies between fixers?

--

___
Python tracker 

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



[issue37992] Change datetime.MINYEAR to allow for negative years

2019-08-31 Thread Paul Ganssle


Paul Ganssle  added the comment:

This is only a semi-arbitrary restriction. Realistically, `datetime` is not a 
particularly good way to represent times much older than the 17th or 18th 
century (and if you're using time zones, it gets increasingly inaccurate as you 
go further back from 1970 or the further in the future you go from the current 
time). Generally, I think the choice to keep it to positive dates is due to a 
combination of the fact that 1. it introduces a lot more edge cases (there's no 
year 0, for example) 2. it may invalidate otherwise perfectly acceptable 
assumptions that people have made in code about the sign of the component 
values and 3. it would be a rarely used feature of dubious utility. I am not 
sure that adding this feature would be worth the support burden it would bring.

There was a discussion about this on the discourse in the past, there wasn't an 
obvious consensus that it would never happen, but I would not say that there 
was much support for the idea: 
https://discuss.python.org/t/bc-date-support/582/2

--

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Bob Kline


Bob Kline  added the comment:

Thanks, I understand. However, this highlights something which had slipped 
under my radar. You get one shot at running a code set through the tool. You 
can't do what I was doing, which was to run the tool in "don't write" mode, 
then fix by hand some of the things it says will need to be done, then run it 
again in the same mode, fix, etc., until I got to the point where I felt like I 
could trust it (except for things like adding unnecessary `list()` wrappers, 
for which I learned how to use the option for suppressing certain default 
fixers), and then run the tool in write mode to fix what was left. I now 
totally get why the tool did what it did, and why the approach I was using was 
inappropriate, but was there a warning to this effect that I missed in the 
documentation? Something like "you can only run this tool once per fixer (or 
set of fixers) in write mode, and you cannot run a fixer on code for which you 
have performed any of the needed conversions for that fixer yourself"? Of cour
 se, it's always possible I'm the only developer clueless enough not to have 
figured this out without such a warning. :-)

Partly in my (lame) defense, I had lured myself into the frame of mind where 
what I was doing seemed to make sense by having just come out of a similar 
exercise with pylint, where iterative "fixing" works just fine. I guess I 
should take this as a good sign, that my brain has moved so far into the Python 
3 world that "..." was no longer recognizable as a bytestring.

Again, thanks for the gentle explanation. :-)

--

___
Python tracker 

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



[issue32805] Possible integer overflow when call PyDTrace_GC_DONE()

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue36254] Fix invalid uses of %d in format strings in C

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue36542] Allow to overwrite the signature for Python functions

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue37702] memory leak in ssl certification

2019-08-31 Thread neonene


neonene  added the comment:

I raised another PR(15632), which keeps the changes to a minimum.
I hope either PR would be in the 3.7.5 / 3.8.0 official.

--

___
Python tracker 

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



[issue37702] memory leak in ssl certification

2019-08-31 Thread neonene


Change by neonene :


--
pull_requests: +15300
pull_request: https://github.com/python/cpython/pull/15632

___
Python tracker 

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



[issue36793] Do not define unneeded __str__ equal to __repr__

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue24416] Return a namedtuple from date.isocalendar()

2019-08-31 Thread Tal Einat


Tal Einat  added the comment:

Dong-hee Na, yes, that would be welcome.

Making a PR would be a great first step.

I also suggest adding a note about the issue unpickling with earlier versions, 
in the NEWS entry and it the "What's New" entry.

--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue25518] Investigate implementation of PyOS_CheckStack on OSX

2019-08-31 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> Implement PyOS_CheckStack on macOS using pthread_get_stack*_np

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Ned Deily


Change by Ned Deily :


--
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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-31 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Matthew Barnett


Matthew Barnett  added the comment:

You wrote "the u had already been removed by hand". By removing the u in the 
_Python 2_ code, you changed that string from a Unicode string to a bytestring.

In a bytestring, \u is not an escape; b"\u" == b"\\u".

--
nosy: +mrabarnett

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Bob Kline


Bob Kline  added the comment:

Ah, this is worse than I first thought. It's not just converting code by adding 
extra backslashes to regular expression strings, where at least the regular 
expression engine will do what the original code was asking the Python parser 
to do (unless user code checks for and enforces limits on regular expression 
string lengths, so even that case is broken), but 2to3 is also mangling strings 
in places where the behavior is changed (that is, broken). 2to3 wants to change

if c not in ".-_:\u00B7\u0e87":

to

if c not in ".-_:\\u00B7\\u0e87":

Not the same thing at all, as illustrated here:

$ python
Python 3.7.3 (default, Jun 19 2019, 07:38:49)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> len("\u00B7")
1
>>> len("\\u00B7")
6
>>>

That breaks the original code. This is a serious bug.

--

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Bob Kline


Bob Kline  added the comment:

The original string had u"""...""" and the u had already been removed by hand 
in preparation for moving to Python 3.

--

___
Python tracker 

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



[issue27227] argparse fails to parse [] when using choices and nargs='*'

2019-08-31 Thread paul j3


Change by paul j3 :


--
nosy: +paul.j3
status: closed -> open

___
Python tracker 

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



[issue37996] 2to3 introduces unwanted extra backslashes for unicode characters in regular expressions

2019-08-31 Thread Bob Kline


New submission from Bob Kline :

-UNWANTED = re.compile("""['".,?!:;()[\]{}<>\u201C\u201D\u00A1\u00BF]+""")
+UNWANTED = 
re.compile("""['".,?!:;()[\]{}<>\\u201C\\u201D\\u00A1\\u00BF]+""")

The non-ASCII characters in the original string are perfectly legitimate str 
characters, using valid standard escapes recognized and handled by the Python 
parser. It is unnecessary to lengthen the string argument passed to 
re.compile() and defer the conversion of the doubled escapes for the regular 
expression engine to handle.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 350922
nosy: bkline
priority: normal
severity: normal
status: open
title: 2to3 introduces unwanted extra backslashes for unicode characters in 
regular expressions
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue24416] Return a namedtuple from date.isocalendar()

2019-08-31 Thread Dong-hee Na


Dong-hee Na  added the comment:

This patch/The patch

--

___
Python tracker 

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



[issue24416] Return a namedtuple from date.isocalendar()

2019-08-31 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstinner @taleinat
This patch of this issue is not merged yet.
If there is no reason to abandon this patch,
is it okay for me to continue working on it?

--
nosy: +corona10, vstinner

___
Python tracker 

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



[issue37764] email.Message.as_string infinite loop

2019-08-31 Thread miss-islington


miss-islington  added the comment:


New changeset c5b242f87f31286ad38991bc3868cf4cfbf2b681 by Miss Islington (bot) 
(Ashwin Ramaswami) in branch 'master':
bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)
https://github.com/python/cpython/commit/c5b242f87f31286ad38991bc3868cf4cfbf2b681


--
nosy: +miss-islington

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-31 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this is fixed with 2a99fd911ebeecedbb250a05667cd46eca4735b9 which would 
be included in 3.7.5 since this missed 3.7.4RC1 . There is also a test for this 
at 
https://github.com/python/cpython/blob/daa82d019c52e95c3c57275307918078c1c0ac81/Lib/test/test_mimetypes.py#L103

--
nosy: +xtreak

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-31 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy:  -vstinner

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-31 Thread Dong-hee Na


Dong-hee Na  added the comment:

It works well on the master branch version but also the latest 3.7 branch
I think that we can close this issue for `.jpe` issue if we don't have to 
support "image/jpg" case.


Python 3.9.0a0 (heads/master:daa82d019c, Aug 31 2019, 23:37:00)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> mimetypes.guess_extension("image/jpg")
>>> mimetypes.guess_extension("image/jpeg")
'.jpg'

Python 3.7.4+ (heads/3.7:9a28400aac, Aug 31 2019, 23:34:02)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> mimetypes.guess_extension("image/jpg")
>>> mimetypes.guess_extension("image/jpeg")
'.jpg'

--
nosy: +corona10, vstinner

___
Python tracker 

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



[issue37953] Fix ForwardRef equality checks

2019-08-31 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue37993] os.path.realpath on Windows resolves mapped network drives

2019-08-31 Thread Eryk Sun


Eryk Sun  added the comment:

>>>> sys.executable
>'X:\\Python38\\python.exe'
>>>> os.path.realpath(sys.executable)
>'SERVER\\Programs\\Python38\\python.exe'

Unix Python resolves the executable path with repeated _Py_wreadlink calls. 
Windows Python should do something similar to ensure the consistency of 
sys.executable with realpath(sys.executable).

> different from mapped network and subst drives (AFAIU).

Mapped and subst drives are implemented as object-manager symlinks to 
file-system directories. For example, a subst drive "S:" might target a local 
directory such as r"\??\C:\Temp\Subst", and a mapped drive "M:" for an SMB 
share might target a path such as r"\Device\LanmanRedirector\;M:\Server\Share\Temp\Mapped". 

The root directory of these drives does not behave like a real root directory 
unless the drive targets the root of a volume or UNC share, such as 
"\\??\\C:\\" or r"\Device\LanmanRedirector;M:\Server\Share".

This means that in many cases it's possible to evaluate a relative symlink that 
traverses above the drive root via ".." components. Say we have a directory 
r"C:\Temp\Subst" that contains a relative symlink "foo_link" that targets 
r"..\foo". If we map "S:" to r"C:\Temp\Subst", then r"S:\foo_link" opens 
r"C:\Temp\foo". Similarly if we map r"\\localhost\C$\Temp\Subst" to "M:", then 
r"M:\foo_link" opens r"C:\Temp\foo".

In the above case, if we're using relpath() to compute the relative path to the 
"foo" target, I think we want relpath(realpath('C:/Temp/foo'), realpath('S:/')) 
to succeed as r"..\foo". I don't think we want it to fail as a cross-drive 
relative path.

--
nosy: +eryksun

___
Python tracker 

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



[issue37992] Change datetime.MINYEAR to allow for negative years

2019-08-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue28964] AST literal_eval exceptions provide no information about line number

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue29477] Lambda with complex arguments is ctx STORE

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> wont fix
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



[issue7682] Optimisation of if with constant expression

2019-08-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This was optimized in 3.7. See issue27169 and issue30501.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage: patch review -> 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



[issue15856] inspect.getsource(SomeClass) doesn't show @decorators

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> inspect.getsource returns incorrect source for classes when 
class definition is part of multiline strings

___
Python tracker 

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +15299
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15631

___
Python tracker 

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue36287.

--

___
Python tracker 

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



[issue37995] Multiline ast.dump()

2019-08-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

ast.dump() is mainly useful for debugging purposes. Unfortunately the output is 
too long and complex even for simple examples. It contains too much nested 
calls and lists. 

>>> import ast
>>> node = ast.parse('spam(eggs, "and cheese")')
>>> print(ast.dump(node))
Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), 
args=[Name(id='eggs', ctx=Load()), Constant(value='and cheese', kind=None)], 
keywords=[]))], type_ignores=[])

It is worse if include more information:

>>> print(ast.dump(node, include_attributes=True))
Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, 
col_offset=0, end_lineno=1, end_col_offset=4), args=[Name(id='eggs', 
ctx=Load(), lineno=1, col_offset=5, end_lineno=1, end_col_offset=9), 
Constant(value='and cheese', kind=None, lineno=1, col_offset=11, end_lineno=1, 
end_col_offset=23)], keywords=[], lineno=1, col_offset=0, end_lineno=1, 
end_col_offset=24), lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)], 
type_ignores=[])

And for larger examples it is almost unusable.

I propose to make ast.dump() producing a multiline indented output. Add the 
optional "indent" parameter. If it is a non-negative number or a string, the 
output if formatted with the specified indentation. If it is None (by default), 
the output is a single string.

>>> print(ast.dump(node, indent=3))
Module(
   body=[
  Expr(
 value=Call(
func=Name(
   id='spam',
   ctx=Load()),
args=[
   Name(
  id='eggs',
  ctx=Load()),
   Constant(
  value='and cheese',
  kind=None)],
keywords=[]))],
   type_ignores=[])

Looks better, no?

I am not sure about closing parenthesis. Should they be attached to the last 
item (as above) or split on a separate line (as below)? Or use some heuristic 
to make the output more readable and compact?

>>> print(ast.dump(node, indent=3))
Module(
   body=[
  Expr(
 value=Call(
func=Name(
   id='spam',
   ctx=Load()
),
args=[
   Name(
  id='eggs',
  ctx=Load()
   ),
   Constant(
  value='and cheese',
  kind=None
   )
],
keywords=[]
 )
  )
   ],
   type_ignores=[]
)

--
components: Library (Lib)
messages: 350913
nosy: benjamin.peterson, brett.cannon, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Multiline ast.dump()
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue37994] Fix silencing all errors if an attribute lookup fails

2019-08-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Previous round of fixing such issues is issue32571.

--

___
Python tracker 

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



[issue37994] Fix silencing all errors if an attribute lookup fails

2019-08-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +15298
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/15630

___
Python tracker 

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



[issue37994] Fix silencing all errors if an attribute lookup fails

2019-08-31 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There are still sites in the CPython code where all errors of failed attribute 
lookup are silenced or overridden by other exception. This can hide such 
exceptions like MemoryError, RecursionError or KeyboardInterrupt and lead to 
incorrect result (as the attribute was just absent instead of looking it up was 
interrapted by side causes). Only AttributeError is expected to signal an 
absence of an attribute, and only it can be silenced.

The proposed PR fixes most of such cases.

There are still few sites where *all* errors are ignored (for example when 
report an error to the stderr or like), they should be considered separately.

--
components: Extension Modules, Interpreter Core
messages: 350911
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fix silencing all errors if an attribute lookup fails
type: behavior
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue37993] os.path.realpath on Windows resolves mapped network drives

2019-08-31 Thread Christoph Gohlke


New submission from Christoph Gohlke :

Re https://bugs.python.org/issue9949:

Is it intended that Python-3.8.0b4 now also resolves mapped network drives and 
drives created with `subst`? 

I would not expect this from the documentation at 
https://docs.python.org/3.8/library/os.path.html#os.path.realpath. The 
documentation refers to symbolic links and junctions, which are different from 
mapped network and subst drives (AFAIU).

For example, mapping `\\SERVER\Programs` as `X:` drive:

```
Python 3.8.0b4 (tags/v3.8.0b4:d93605d, Aug 29 2019, 23:21:28) [MSC v.1916 64 
bit (AMD64)] on win32
>>> import sys, os
>>> sys.executable
'X:\\Python38\\python.exe'
>>> os.path.realpath(sys.executable)
'SERVER\\Programs\\Python38\\python.exe'
```

```
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit 
(AMD64)] on win32
>>> import sys, os
>>> sys.executable
'X:\\Python37\\python.exe'
>>> os.path.realpath(sys.executable)
'X:\\Python37\\python.exe'
```

It seems this change causes an error in pytest-5.1.2 during numpy-1.17.1 tests:

```
X:\Python38>python.exe -c"import numpy;numpy.test()"
NumPy version 1.17.1
NumPy relaxed strides checking option: True

= ERRORS 
==
__ ERROR collecting test session 
__
lib\site-packages\_pytest\config\__init__.py:440: in _importconftest
return self._conftestpath2mod[conftestpath]
E   KeyError: 
local('SERVER\\programs\\python38\\lib\\site-packages\\numpy\\conftest.py')

During handling of the above exception, another exception occurred:
lib\site-packages\_pytest\config\__init__.py:446: in _importconftest
mod = conftestpath.pyimport()
lib\site-packages\py\_path\local.py:721: in pyimport
raise self.ImportMismatchError(modname, modfile, self)
E   py._path.local.LocalPath.ImportMismatchError: ('numpy.conftest', 
'X:\\Python38\\lib\\site-packages\\numpy\\conftest.py', 
local('SERVER\\programs\\python38\\lib\\site-packages\\numpy\\conftest.py'))

During handling of the above exception, another exception occurred:
lib\site-packages\_pytest\runner.py:220: in from_call
result = func()
lib\site-packages\_pytest\runner.py:247: in 
call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
lib\site-packages\_pytest\main.py:485: in collect
yield from self._collect(arg)
lib\site-packages\_pytest\main.py:512: in _collect
col = self._collectfile(pkginit, handle_dupes=False)
lib\site-packages\_pytest\main.py:581: in _collectfile
ihook = self.gethookproxy(path)
lib\site-packages\_pytest\main.py:424: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
lib\site-packages\_pytest\config\__init__.py:420: in _getconftestmodules
mod = self._importconftest(conftestpath)
lib\site-packages\_pytest\config\__init__.py:454: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: 
(local('SERVER\\programs\\python38\\lib\\site-packages\\numpy\\conftest.py'),
 (, 
ImportMismatchError('numpy.conftest', 
'X:\\Python38\\lib\\site-packages\\numpy\\conftest.py', 
local('SERVER\\programs\\python38\\lib\\site-packages\\numpy\\conftest.py')),
 ))
! Interrupted: 1 errors during collection 
!
1 error in 16.39s
```

--
components: Library (Lib), Windows
messages: 350910
nosy: cgohlke, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.realpath on Windows resolves mapped network drives
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



[issue37977] Big red pickle security warning should stress the point even more

2019-08-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> 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



[issue37977] Big red pickle security warning should stress the point even more

2019-08-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 6922b9e4fce635339cb94c2fdef6bba4e2a99621 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-37977: Warn more strongly and clearly about pickle security (GH-15595) 
(GH-15629)
https://github.com/python/cpython/commit/6922b9e4fce635339cb94c2fdef6bba4e2a99621


--

___
Python tracker 

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