[issue12445] dict view values objects are missing tp_richcmp and tp_as_number

2022-04-05 Thread Peter Lovett


Change by Peter Lovett :


--
nosy: +PeterL777

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Peter Lovett  added the comment:

Thanks Eric.

--

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Peter Lovett  added the comment:

I'm not getting the problem on 3.9.7 on Windows. 
Did get it on 3.7 (3.7.11?) on a different Windows machine last week.
Not getting the problem on 3.10.4

The wrong line number is a problem for IDLE's syntax highlighter, that marks 
the first line as a Syntax Error, even if that line is a comment. 

This is an issue for ArcGIS Pro users, which is (I think) currently shipping 
with Python 3.7.11, so those users may come across it. Best solution would be 
for Esri to update their Python version to something newer.
https://support.esri.com/en/technical-article/13224

--

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Change by Peter Lovett :


--
nosy: +PeterL777

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



[issue44446] linecache.getline TypeError when formatting tracebacks in stacks containing an async list comprehension

2022-03-02 Thread Peter Roelants


Peter Roelants  added the comment:

If I understand correctly this should be fixed? In which 3.10.* version should 
this be fixed?

The reason why I'm asking is that I ran into this issue when using Dask 
(2022.02.0) with multithreading on Python 3.10.2:

Exception in thread Profile:
Traceback (most recent call last):
  File "./lib/python3.10/site-packages/distributed/profile.py", line 115, in 
process
d = state["children"][ident]
KeyError: '_all_objs;./lib/python3.10/site-packages/bokeh/embed/bundle.py;357'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
  File "./lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
  File "./lib/python3.10/site-packages/distributed/profile.py", line 274, in 
_watch
process(frame, None, recent, omit=omit)
  File "./lib/python3.10/site-packages/distributed/profile.py", line 119, in 
process
"description": info_frame(frame),
  File "./lib/python3.10/site-packages/distributed/profile.py", line 72, in 
info_frame
line = linecache.getline(co.co_filename, frame.f_lineno, 
frame.f_globals).lstrip()
  File "./lib/python3.10/linecache.py", line 31, in getline
if 1 <= lineno <= len(lines):
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

--
nosy: +peter.roelants
versions: +Python 3.10 -Python 3.11

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



[issue46153] function fails in exec when locals is given

2021-12-23 Thread Quentin Peter


Quentin Peter  added the comment:

Maybe a note could be added to 
https://docs.python.org/3/library/functions.html#exec

Something along the lines of:

Note: If exec gets two separate objects as `globals` and `locals`, the code 
will not be executed as if it were embedded in a function definition. For 
example, any function or comprehension defined at the top level will not have 
access to the `locals` scope.

PS: It would be nice for my usecase to have a way around this, maybe a flag in 
`compile` or `exec` that would produce "function code" instead of "module 
code". My workaround for this problem consist in wrapping my code in a function 
definition.

I think this means https://bugs.python.org/issue41918 should be closed as well?

--

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



[issue46153] function fails in exec when locals is given

2021-12-22 Thread Quentin Peter


Quentin Peter  added the comment:

Thank you for your explaination. Just to be sure, it is expected that:

exec("a = 1\ndef f(): return a\nprint(f())", {})

Runs successfully but

exec("a = 1\ndef f(): return a\nprint(f())", {}, {})

Doesn't?

--

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



[issue46153] function fails in exec when locals is given

2021-12-22 Thread Quentin Peter


Quentin Peter  added the comment:

The reason I am asking is that I am working on a debugger. The debugger stops 
on a frame which is inside a function. Let's say the locals is:
locals() == {"a": 1}
I now want to define a closure with exec. I might want to do something like:
exec("def f(): return a", globals(), locals())
But this doesn't work because of the issue I describe.I would expect f() to 
look for a in the locals().

Even more surprising is that if I use the second argument of exec, the code in 
the above comment starts to fail.

--

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



[issue46153] closure fails in exec when locals is given

2021-12-22 Thread Quentin Peter


Quentin Peter  added the comment:

This might be related to https://bugs.python.org/issue41918

--

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



[issue46153] closure fails in exec when locals is given

2021-12-22 Thread Quentin Peter


New submission from Quentin Peter :

When both namespace arguments are given to exec, function definitions fail to 
capture closure. See below:
```
Python 3.8.6 (default, Oct  8 2020, 14:06:32) 
[Clang 12.0.0 (clang-1200.0.32.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exec("a = 1\ndef f(): return a\nprint(f())")
1
>>> exec("a = 1\ndef f(): return a\nprint(f())", {})
1
>>> exec("a = 1\ndef f(): return a\nprint(f())", {}, {})
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in 
  File "", line 2, in f
NameError: name 'a' is not defined
>>> 
```

--
messages: 409038
nosy: qpeter
priority: normal
severity: normal
status: open
title: closure fails in exec when locals is given
type: crash
versions: Python 3.8

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



[issue45882] mailbox fails to read message from mbox

2021-11-23 Thread Peter Wurmsdobler


New submission from Peter Wurmsdobler :

When using mailbox to convert mbox files to maildir, I have noticed that it 
cannot handle messages in the mbox file that start with two subsequent `From` 
lines in the header like:

```
>From - Fri Feb 20 09:46:18 1998
>From na...@company.com Wed Feb 18 18:38:38 1998
```

A new maildir message will be created, but none of fields following the two 
header lines such as `Date` etc. will be parsed; the result is a message with 
header and body inside the message.

--
components: Library (Lib)
messages: 406873
nosy: peter4
priority: normal
severity: normal
status: open
title: mailbox fails to read message from mbox
type: behavior
versions: Python 3.8

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



[issue45586] Use starred expressions in subscripts

2021-10-25 Thread Peter Tillema


Peter Tillema  added the comment:

Right, I should have clarified it a bit more. I'm using NumPy arrays because 
they allow indexing like this, where the input arguments are converted to a 
tuple. So
   a[1, 2, *[3, 4]]
is different than
   a[[1, 2, *[3, 4]]]

This indeed only works on NumPy arrays, although I would like to see such 
feature implemented for real lists!

--

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



[issue45586] Use starred expressions in list indices

2021-10-23 Thread Peter Tillema


New submission from Peter Tillema :

It would be nice if you could starred expressions in list indices, for example 
this piece of code:

```
import numpy as np

a = np.array(0)
print(a[1, *[2, 3], 4])
```

--
components: Interpreter Core
messages: 404860
nosy: PeterTillema
priority: normal
severity: normal
status: open
title: Use starred expressions in list indices
versions: Python 3.10

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



[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2021-06-22 Thread Peter V


Peter V  added the comment:

I'm new to Python bugtracker and I may misunderstand the discussion. But I 
think this is a real bug in argparse, not a documentation problem.

My usecase was that I wanted to add argparse to a GUI application where print 
and exit is a wrong option. So I set 
`argparse.ArgumentParser(exit_on_error=False)` but I failed with that, system 
exited whatever I tried. Exit in this case is not an option, I expected a 
dedicated exception after that. 

Digging a bit deeper I found that I can create a custom class and overwrite the 
`ArgumentParser.exit(status=0, message=None)` but still, as a simple user of 
the standard library why should I do that?

This would be a minimalist example how this can be solved in argparse code:

def exit(self, status=0, message=None):
if message:
self._print_message(message, _sys.stderr)
if self.exit_on_error:
_sys.exit(status)
else:
raise ArgumentError(...)

But considering GUI or interactive usage this is still not enough, sys.stdout 
and sys.stderr is written, that do not exists in GUI case, so these parts also 
need some re-design.

--
nosy: +bigbird

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



[issue23786] test_unaligned_buffers (test.test_hash.HashEqualityTestCase) ... Fatal Python error: Bus error

2021-06-16 Thread Peter


Peter  added the comment:

We've migrated our python process off Solaris.

--
stage:  -> resolved
status: open -> closed

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



[issue44280] unittest filters out too many assertion stack frames from context/cause chains

2021-06-01 Thread Peter Hawkins


Change by Peter Hawkins :


--
components: +Library (Lib)
type:  -> behavior

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



[issue44280] unittest filters out too many assertion stack frames from context/cause chains

2021-06-01 Thread Peter Hawkins


New submission from Peter Hawkins :

Example repro:
```
import unittest


def d():
  assert 2 == 3

def c():
  d()

def b():
  c()

def a():
  try:
b()
  except Exception as e:
assert 1 == 2


class MyTest(unittest.TestCase):

  def testException(self):
a()


if __name__ == '__main__':
  unittest.main()
```

Example output from Python 3.9.0:
```
$ python atest.py
F
==
FAIL: testException (__main__.MyTest)
--
Traceback (most recent call last):
  File "/private/tmp/atest.py", line 15, in a
b()
  File "/private/tmp/atest.py", line 11, in b
c()
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/tmp/atest.py", line 23, in testException
a()
  File "/private/tmp/atest.py", line 17, in a
assert 1 == 2
AssertionError

--
Ran 1 test in 0.000s

FAILED (failures=1)
```

Too many frames have been filtered out of the `__context__` exception, 
including a number of relevant frames for `c` and `d`. I believe this happens 
because unittest sets a `limit` here based on the contents of the main 
traceback:
https://github.com/python/cpython/blob/39dd141a4ba68bbb38fd00a65cdcff711acdafb5/Lib/unittest/result.py#L182

but that limit applies recursively to the `__context__` and `__cause__` chains, 
when the intent of the limit was presumably only to filter the main exception.

--
messages: 394865
nosy: peter.hawkins
priority: normal
severity: normal
status: open
title: unittest filters out too many assertion stack frames from context/cause 
chains
versions: Python 3.9

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



[issue43715] curses inch() and scrbkgd() documentation ommissions

2021-04-10 Thread Peter J. Farley III


Peter J. Farley III  added the comment:

Sorry, this was not meant as a patch.  I have no experience with git or
pulls and would not know where to start to do as you have asked.  The text
I provided was intended as model text for the python documentation
maintainer to type into whatever piece of python is used to describe those
two functions.

If I knew where to pull a source archive or zip and knew the place or
source member where that documentation is stored, I could generate a "diff
-u" style of patch, but that is the limit of my skill in that area.

Peter

On Thu, Apr 8, 2021 at 10:18 AM Mariatta  wrote:

>
> Mariatta  added the comment:
>
> Thanks for the patch, but I find it difficult to read in plain text. Can
> you create a pull request with the your suggested changes?
>
> --
> nosy: +Mariatta
>
> ___
> Python tracker 
> <https://bugs.python.org/issue43715>
> ___
>

--

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



[issue43716] curses.pair_number() function incorrect value under Windows

2021-04-10 Thread Peter J. Farley III


Peter J. Farley III  added the comment:

Thank you for responding.  I will pursue the issue with the windows-curses
and/or PDCurses team.

Peter

On Wed, Apr 7, 2021 at 12:57 PM Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> The curses module is not supported on Windows. windows-curses is a
> third-party library. Use the corresponding bug tracker to report an issue
> with windows-curses.
>
> --
>
>

--

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



[issue43716] curses.pair_number() function incorrect value under Windows

2021-04-03 Thread Peter J. Farley III


New submission from Peter J. Farley III :

curses.pair_number() result under Windows (console or Terminal window) value 
must be shifted by 16 bits to be valid to use as input to the 
curses.pair_content() function.

If the pair number result is not shifted, the call to curses.pair_content() 
fails with an overflow error:

Traceback (most recent call last):
  File "C:\Users\MyUser\test\curses-color.py", line 126, in 
curses.wrapper(main)
  File "C:\Python38\lib\curses\__init__.py", line 105, in wrapper
return func(stdscr, *args, **kwds)
  File "C:\Users\MyUser\test\curses-color.py", line 72, in main
fg, bg = curses.pair_content (pair)
OverflowError: signed short integer is greater than maximum

The attached curses program demonstrates the correct functioning using the pair 
value shift under Windows.  Comment out the "if" and shift lines to reproduce 
the overflow error.

Environment information:

Windows 10 (latest updates)
Windows cmd.exe window or Windows Terminal Version: 1.6.10571.0
Python 3.8.7
windows-curses 2.2.0

Also tested in:

Ubuntu 20.04 (WSL2)
ncurses6/focal,now 6.2-0ubuntu2 amd64

--
components: Extension Modules
files: curses-color-1.py
messages: 390137
nosy: pjfarleyiii
priority: normal
severity: normal
status: open
title: curses.pair_number() function incorrect value under Windows
versions: Python 3.8
Added file: https://bugs.python.org/file49931/curses-color-1.py

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



[issue43715] curses inch() and scrbkgd() documentation ommissions

2021-04-03 Thread Peter J. Farley III


New submission from Peter J. Farley III :

The documentation for the result values of curses functions inch() and 
scrbkgd() or how to use those result values are omitted entirely.  
Documentation should at least describe how to use the result values of these 
functions without necessarily describing the actual format of the results, 
which do differ depending on the implementation of curses being used.

A suggestion for the documentation change is attached.

A separate issue will be filed questioning the need to shift the pair number 
result of the curses.pair_number() function in the Windows terminal environment.

--
components: Extension Modules
files: curses-doc-change.txt
messages: 390136
nosy: pjfarleyiii
priority: normal
severity: normal
status: open
title: curses inch() and scrbkgd() documentation ommissions
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49930/curses-doc-change.txt

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



[issue43412] object.h -Wcast-qual warning

2021-03-05 Thread Peter Eisentraut


New submission from Peter Eisentraut :

object.h contains an inline function that causes a -Wcast-qual warning from 
gcc.  Since this file ends up visible in third-party code that includes 
Python.h, this makes it impossible to use -Wcast-qual in such code.

The problem is the change c5cb077ab3c88394b7ac8ed4e746bd31b53e39f1, which 
replaced ob->ob_type by Py_TYPE(ob), which seems reasonable by itself, but 
Py_TYPE casts away the const, so it creates this problem.

This is a regression in Python 3.10.

--
components: Interpreter Core
messages: 388167
nosy: petere
priority: normal
severity: normal
status: open
title: object.h -Wcast-qual warning
versions: Python 3.10

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



[issue43049] Use io.IncrementalNewlineDecoder for doctest newline conversion

2021-03-02 Thread Peter Donis


Peter Donis  added the comment:

Thanks for merging!

--

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



[issue43049] Use io.IncrementalNewlineDecoder for doctest newline conversion

2021-01-27 Thread Peter Donis


Change by Peter Donis :


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

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



[issue1812] doctest _load_testfile function -- newline handling seems incorrect

2021-01-27 Thread Peter Donis


Change by Peter Donis :


--
pull_requests: +23184
pull_request: https://github.com/python/cpython/pull/24359

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



[issue43049] Use io.IncrementalNewlineDecoder for doctest newline conversion

2021-01-27 Thread Peter Donis


New submission from Peter Donis :

This is a follow-up to issue 1812:

https://bugs.python.org/issue1812

It was suggested in the discussion on that issue that the newline conversion in 
doctest that was corrected in that issue could be done using already defined 
resources in the io module instead of by a custom function. This issue is to 
provide an issue number for my pull request on github to do that: the io module 
provides the IncrementalNewlineDecoder object that does exactly what is needed.

--
components: Tests
messages: 385830
nosy: pdonis
priority: normal
severity: normal
status: open
title: Use io.IncrementalNewlineDecoder for doctest newline conversion
type: enhancement
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9

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



[issue42900] Ternary operator precedence relative to bitwise or

2021-01-11 Thread Peter


New submission from Peter :

Hello,

I expect the following code to run fine, but the assertion fails. dbg1 is 1, 
while dbg2 is 3.  I thought they would both be 3.
Note that the only difference between the expressions for dbg1 and dbg2 are the 
parentheses.
Please accept my apologies if this is expected behavior, but it came as a big 
surprise to me.


import json
if __name__ == "__main__":
msg = '''
{
"Sync Setup Flags": {
"Setup Sync": "Enable",
"Generate Primary Sync": "Enable",
"Backup Primary Sync": "Disable",
"Follow Only": "Disable",
"Use Local Clock": "Disable",
"Set Active": "Disable"
}
}
'''
obj = json.loads(msg)
dbg1 = \
1 if obj["Sync Setup Flags"]["Setup Sync"] == "Enable" else 0 | \
2 if obj["Sync Setup Flags"]["Generate Primary Sync"] == "Enable" else 
0 | \
4 if obj["Sync Setup Flags"]["Backup Primary Sync"] == "Enable" else 0 
| \
8 if obj["Sync Setup Flags"]["Follow Only"] == "Enable" else 0 | \
16 if obj["Sync Setup Flags"]["Use Local Clock"] == "Enable" else 0 | \
128 if obj["Sync Setup Flags"]["Set Active"] == "Enable" else 0
dbg2 = \
(1 if obj["Sync Setup Flags"]["Setup Sync"] == "Enable" else 0) | \
(2 if obj["Sync Setup Flags"]["Generate Primary Sync"] == "Enable" else 
0) | \
(4 if obj["Sync Setup Flags"]["Backup Primary Sync"] == "Enable" else 
0) | \
(8 if obj["Sync Setup Flags"]["Follow Only"] == "Enable" else 0) | \
(16 if obj["Sync Setup Flags"]["Use Local Clock"] == "Enable" else 0) | 
\
(128 if obj["Sync Setup Flags"]["Set Active"] == "Enable" else 0)

assert(dbg1 == dbg2)

--
messages: 384874
nosy: amazingmo
priority: normal
severity: normal
status: open
title: Ternary operator precedence relative to bitwise or
type: behavior
versions: Python 3.6

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



[issue42897] Expose a way to determine if a process has been closed or not

2021-01-11 Thread Peter Van Sickel


New submission from Peter Van Sickel :

I have been using the multiprocessing Process class a good bit lately. I have a 
class that is managing the a given list of processes from launch to completion. 
Recently I started using Process close().  I found myself wanting to determine 
if a given process instance was closed or not before I did anything like check 
its exitcode or invoke any of the other methods that raise a ValueError if done 
so on a closed process.
As far as I can tell there is no exposed way to check if the process is closed. 
 The Process class has a _closed instance variable and a _check_closed() 
method, but those are not intended for direct use.
I created a simple wrapper class that has its own closed instance variable and 
wraps the close() method of Process so that the closed instance variable can be 
set to True when close() is called and then call super().close() to allow the 
normal close operation to complete.
It would be convenient if the Process class itself supported an is_closed() 
method or exposed a Boolean closed attribute to easily determine if a process 
instance has been closed.

--
messages: 384860
nosy: petervansickel
priority: normal
severity: normal
status: open
title: Expose a way to determine if a process has been closed or not
type: enhancement
versions: Python 3.10

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



[issue42826] typing.Iterable does not need __getitem__() method

2021-01-04 Thread Peter Pavlinič

Peter Pavlinič  added the comment:

In documentation it is written that typing.Iterable can be implemented with 
__getitem__() method that implements Sequence semantics.

That is not correct. link: 

/glossary.html#term-iterable

--

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



[issue42826] typing.Iterable does not need __getitem__() method

2021-01-04 Thread Peter Pavlinič

Peter Pavlinič  added the comment:

In documentation it is written that typing.Iterable can be implemented with 
__getitem__() method that implements Sequence semantics.

That is not correct. link: 

https://docs.python.org/3.79/glossary.html#term-iterable

--
title: typing.Iterable does not need__getitem__() method -> typing.Iterable 
does not need __getitem__() method

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



[issue42826] typing.Iterable does not need__getitem__() method

2021-01-04 Thread Peter Pavlinič

New submission from Peter Pavlinič :

https://docs.python.org/3.10/glossary.html#term-iterable

--
assignee: docs@python
components: Documentation
messages: 384334
nosy: docs@python, peter.pavlinic
priority: normal
severity: normal
status: open
title: typing.Iterable does not need__getitem__() method
type: enhancement
versions: Python 3.10

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



[issue36541] Make lib2to3 grammar better match Python, support the := walrus

2020-12-06 Thread Peter Ludemann


Peter Ludemann  added the comment:

Every piece of code that uses either lib2to3 or a parser derived from it 
(including parso and LibCST) will eventually not be able to upgrade the parser 
because PEG can handle grammars that LL(k) can't. That's why I proposed adding 
some functionality to ast.parse, to make the whitespace and token information 
easily available - this seems to be what @BTaskaya says is "easy" (maybe they 
mean it's easy using LibCST? It seems to be fiddly using ast.parse). The 
alternative is that all these projects (black, LibCST, yapf, etc.) will have to 
roll their own solutions, which doesn't seem a very productive use of people's 
time and makes version upgrades slow.

If people are interested in using ast.parse extensions as a replacement for 
lib2to3, I suggest discussing at 
https://mail.python.org/archives/list/python-id...@python.org/thread/X2HJ6I6XLIGRZDB27HRHIVQC3RXNZAY4/

--

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



[issue36541] Make lib2to3 grammar better match Python, support the := walrus

2020-12-04 Thread Peter Ludemann


Peter Ludemann  added the comment:

I made a suggestion for augmenting ast.parse with some of lib2to3's features; 
but nobody seemed interested. 

RIP lib2to3. Like many pieces of software, it was used for far more than for 
what it was originally intended.

https://mail.python.org/archives/list/python-id...@python.org/thread/X2HJ6I6XLIGRZDB27HRHIVQC3RXNZAY4/

--

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



[issue42495] socket.gethostbyaddr raises error if invalid unicode in hosts

2020-11-30 Thread Peter Hunt


Peter Hunt  added the comment:

Ah, I just realised it may have been a different dash to the one that can be 
typed with the keyboard.

>From the wiki article (https://en.wikipedia.org/wiki/Dash), using either the 
>"en" or "em" dash will cause the issue for me on Windows.

--

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



[issue42495] socket.gethostbyaddr raises error if invalid unicode in hosts

2020-11-28 Thread Peter Hunt


New submission from Peter Hunt :

If the hosts file contains invalid unicode, then the socket module will break 
when attempting to get the list of hosts. This renders modules such as Flask 
and Django unusable.

Background:
I had a mapping to localghost 
(https://twitter.com/rfreebern/status/1214560971185778693), and Docker 
incorrectly rewrote the hosts file during installation, turning it from 
"127.0.0.1 xn--9q8h" to "127.0.0.1 xn-9q8h".
The socket module was not able to handle that, and was failing with a 
UnicodeDecodeError in Python 3.6+ as it attempted to list the addresses for 
"127.0.0.1".

How to reproduce:
# Add "127.0.0.1 xn-9q8h" to C:/Windows/System32/drivers/etc/hosts

>>> socket.gethostbyaddr('127.0.0.1')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 2: 
invalid start byte

Expected:
In Python 2.7 - 3.5, it returns 'xn\u20139q8h'.
I feel returning "xn-9q8h" as a string would be best, but ignoring it could 
be an option.
An alternative would be to raise socket.error.

Full traceback from Flask as an example:

Traceback (most recent call last):
File "__init__.py", line 285, in 
app.run()
File 
"C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\flask\app.py", 
line 990, in run
run_simple(host, port, self, **options)
File 
"C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\werkzeug\serving.py",
 line 1052, in run_simple
inner()
File 
"C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\werkzeug\serving.py",
 line 1005, in inner
fd=fd,
File 
"C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\werkzeug\serving.py",
 line 848, in make_server
host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
File 
"C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\werkzeug\serving.py",
 line 740, in __init__
HTTPServer.__init__(self, server_address, handler)
File "C:\Program Files\Python37\lib\socketserver.py", line 452, in __init__
self.server_bind()
File "C:\Program Files\Python37\lib\http\server.py", line 139, in 
server_bind
self.server_name = socket.getfqdn(host)
File "C:\Program Files\Python37\lib\socket.py", line 676, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 2: 
invalid start byte

--
components: Library (Lib), Unicode, Windows
messages: 382029
nosy: Peter92, ezio.melotti, paul.moore, steve.dower, tim.golden, vstinner, 
zach.ware
priority: normal
severity: normal
status: open
title: socket.gethostbyaddr raises error if invalid unicode in hosts
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue42450] Docstrings in itertools recipes should have triple-quotes

2020-11-23 Thread Peter Norvig


New submission from Peter Norvig :

In the itertools recipes (  
https://docs.python.org/3/library/itertools.html#itertools-recipes ) there are 
21 functions that have single-quote docstrings. These should be changed to 
triple-quotes, as mandated in PEP 257.

--
messages: 381704
nosy: peter.norvig2
priority: normal
severity: normal
status: open
title: Docstrings in itertools recipes should have triple-quotes
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue23987] docs about containers membership testing wrong for broken objects

2020-11-18 Thread Peter Nowee


Change by Peter Nowee :


--
nosy: +peternowee

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



[issue42173] Drop Solaris support

2020-10-29 Thread Peter Firmstone


Peter Firmstone  added the comment:

No, please continue supporting Illumos, I'm still using it.  Illumos is still 
relevant on servers.

--
nosy: +pfirmsto

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



[issue42170] splitdrive fails for UNC path with the "\\?\UNC\" prefix.

2020-10-27 Thread Quentin Peter


Change by Quentin Peter :


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

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



[issue42170] splitdrive fails for UNC path with the "\\?\UNC\" prefix.

2020-10-27 Thread Quentin Peter


New submission from Quentin Peter :

Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.18.1 -- An enhanced Interactive Python.

In [1]: import os.path

In [2]: os.path.splitdrive(r"\\machine\mountpoint\directory")
Out[2]: ('machine\\mountpoint', '\\directory')

In [3]: os.path.splitdrive(r"\\?\UNC\machine\mountpoint\directory")
Out[3]: ('?\\UNC', '\\machine\\mountpoint\\directory')

In [4]:

--

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



[issue42170] splitdrive fails for UNC path with the "\\?\UNC\" prefix.

2020-10-27 Thread Quentin Peter


Change by Quentin Peter :


--
components: Library (Lib)
nosy: qpeter
priority: normal
severity: normal
status: open
title: splitdrive fails for UNC path with the "\\?\UNC\" prefix.
type: behavior
versions: Python 3.7

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



[issue41918] exec fails to take locals into account when running list comprehensions or functions

2020-10-14 Thread Quentin Peter


Quentin Peter  added the comment:

Fails for functions as well:
```
In [4]: exec(compile('print(my_var)\ndef a():\n print(my_var)\na()', '', 
'exec'), globals(), {"my_var": 0})
0
Traceback (most recent call last):

File "", line 1, in 
exec(compile('print(my_var)\ndef a():\n print(my_var)\na()', '', 
'exec'), globals(), {"my_var": 0})

File "", line 4, in 

 File "", line 3, in a

NameError: name 'my_var' is not defined
```

--
title: exec fails to take locals into account when running list comprehensions 
-> exec fails to take locals into account when running list comprehensions or 
functions

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



[issue41918] exec fails to take locals into account when running list comprehensions

2020-10-03 Thread Quentin Peter


New submission from Quentin Peter :

The exec function fails to take locals into account when executing a list 
comprehension:
```
Python 3.7.7 (default, Mar 10 2020, 15:43:33) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exec(compile('[my_var for i in range(1)]\n', '', 'single'), 
>>> {**globals(), "my_var": 0}, None)
[0]
>>> exec(compile('[my_var for i in range(1)]\n', '', 'single'), 
>>> globals(), {"my_var": 0})
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1, in 
  File "", line 1, in 
NameError: name 'my_var' is not defined
>>> 
```
This is the cause of https://bugs.python.org/issue21161

--
messages: 377862
nosy: qpeter
priority: normal
severity: normal
status: open
title: exec fails to take locals into account when running list comprehensions
type: enhancement
versions: Python 3.7

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



[issue41815] SQLite: segfault if backup called on closed database

2020-09-19 Thread Peter McCormick


Peter McCormick  added the comment:

Updated sample script, thanks to @aeros for catching the omission:

```
import sqlite3
target = sqlite3.connect(':memory:')
source = sqlite3.connect(':memory:')
source.close()
source.backup(target)
```

--

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



[issue41815] SQLite: segfault if backup called on closed database

2020-09-19 Thread Peter McCormick


New submission from Peter McCormick :

Attempting to backup a closed database will trigger segfault:

```
target = sqlite.connect(':memory:')
source = sqlite.connect(":memory:")
source.close()
source.backup(target)
```

--
files: fix.patch
keywords: patch
messages: 377176
nosy: pdmccormick
priority: normal
severity: normal
status: open
title: SQLite: segfault if backup called on closed database
type: crash
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49464/fix.patch

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



[issue36094] When using an SMTP SSL connection,, get ValueError.

2020-09-04 Thread Peter Stokes

Peter Stokes  added the comment:

I wanted to enquire as to if/when the proposed PR11998 is likely to be merged?

I also wanted to note the similarity between this issue and issue41470 and to 
suggest that whilst the change proposed in commit e445ccbc of PR11998 [1] would 
be welcome, there may be a case for exposing the value ultimately passed as the 
`server_hostname` parameter to the `SSLContext.wrap_socket(…)` call [2] as a 
parameter to `SMTP.connect(…)` [3]. Doing so would aid potential use cases 
whereby the `host` parameter provided is an address, yet the TLS server 
hostname validation should be based upon another value (i.e. the hostname); 
potentially useful in scenarios where the `host`'s address has been previously 
derived, by the caller, by other means (e.g. a call to `socket.getaddrinfo(…)` 
[4]).

[1] 
https://github.com/python/cpython/pull/11998/commits/e445ccbc483dfde74638dbb694132dc00ced4973
[2] https://docs.python.org/3/library/ssl.html#ssl.SSLContext.wrap_socket
[3] https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.connect
[4] https://docs.python.org/3/library/socket.html#socket.getaddrinfo

--
nosy: +Dadeos

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



[issue41526] Python 3.9.0rc1 "setup successful" dialog box overflow

2020-08-17 Thread Peter Lovett


Peter Lovett  added the comment:

:-)

--

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



[issue41526] Python 3.9.0rc1 "setup successful" dialog box overflow

2020-08-11 Thread Peter Lovett


New submission from Peter Lovett :

"Setup was successful" dialog box text overflows the box, and last line can't 
be read.

--
components: Installation
files: Python 3.9.0rc1 setup successful overflow dialog box.PNG
messages: 375206
nosy: PeterL777
priority: normal
severity: normal
status: open
title: Python 3.9.0rc1 "setup successful" dialog box overflow
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49383/Python 3.9.0rc1 setup successful 
overflow dialog box.PNG

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



[issue41525] Python '--help' has corrupted text.

2020-08-11 Thread Peter Lovett


Peter Lovett  added the comment:

Also appearing in 3.9.0rc1 AMD64
I think it's transliterated Unicode, rather than an actual corruption. I'm on 
Win10, so it might be a Windows command shell issue (although it is showing bad 
in cmd, PS7 and PS5).
Help messages should be plain ASCII to avoid this issue.

--
nosy: +PeterL777
versions: +Python 3.9

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



[issue41470] smtplib.SMTP should reset internal 'helo' and 'ehlo' state within 'connect()'

2020-08-04 Thread Peter Stokes

New submission from Peter Stokes :

Attempting to reuse an instance of 'smtplib.SMTP', via invocation of the 
'smtplib.SMTP.connect(…)' function, results in an invalid SMTP command sequence 
being issued to the connected server:

```
import smtplib

smtp = smtplib.SMTP()
smtp.connect('smtp.gmail.com')
smtp.ehlo_or_helo_if_needed()
smtp.close()
try:
smtp.quit()
except smtplib.SMTPServerDisconnected:
pass
smtp.connect('smtp.gmail.com')
print(smtp.mail('u...@example.com'))
```

results in "(503, b'5.5.1 EHLO/HELO first. … - gsmtp')"

The values stored in 'self.helo_resp' and 'self.ehlo_resp', as considered 
within 'smtplib.SMTP.ehlo_or_helo_if_needed()' [1], should be reset to a value 
of 'None' upon successfully establishing a new connection to a server. The 
correct sentiment is expressed within 'smtplib.SMTP.quit()' [2] but this 
resetting of state should be performed upon establishing a new connection 
rather than termination of an old connection. Whilst the simplified example 
provided is arguably an invalid use of the 'smtplib.SMTP' library the scenario 
can occur, specifically when the initial connection is unilaterally terminated 
by the server, which makes the reset logic provided in 'smtplib.SMTP.quit()' 
inaccessible due to the 'smtplib.SMTPServerDisconnected' exception raised as a 
consequence of attempting to execute an SMTP 'QUIT' command over a disconnected 
socket.

[1] 
https://github.com/python/cpython/blob/da51ba442c7bf717872633676207c1ae10e99c99/Lib/smtplib.py#L603
[2] 
https://github.com/python/cpython/blob/da51ba442c7bf717872633676207c1ae10e99c99/Lib/smtplib.py#L989L990

--
components: email
messages: 374798
nosy: Dadeos, barry, r.david.murray
priority: normal
severity: normal
status: open
title: smtplib.SMTP should reset internal 'helo' and 'ehlo' state within 
'connect()'
type: behavior
versions: Python 3.8

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



[issue41270] NamedTemporaryFile is not its own iterator.

2020-07-10 Thread Peter


Change by Peter :


--
nosy: +maubp

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



[issue41259] Find adverbs is not correct on the documentation

2020-07-09 Thread Peter Otten


Peter Otten <__pete...@web.de> added the comment:

While I don't want to start a philosical discussion -- is that really better? 
Finding adverbs with a regex doesn't work in the general case -- think 
butterfly, panoply, well -- and the example is meant to illustrate the usage of 
re.findall() rather than regex syntax.

"finding adverbs" is just shorter and easier to understand than "finding 
sequences of word characters that end with "ly".

--
nosy: +peter.otten

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-08 Thread Peter Ludemann


Peter Ludemann  added the comment:

Yes, I'm thinking of doing this as a wrapper, in such a way that it could be 
incorporated into Lib/ast.py eventually. (Also, any lib2to3-ish capabilities 
would probably not be suitable for inclusion in the stdlib, at least not 
initially ... but I have no plans to work on something to replace lib2to3's 
fixers.)

--

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-08 Thread Peter Ludemann


Peter Ludemann  added the comment:

I've written up a proposal for adding "whitespace" handling to the ast module:
https://mail.python.org/archives/list/python-id...@python.org/thread/X2HJ6I6XLIGRZDB27HRHIVQC3RXNZAY4/

I don't think it's a "summer-of-code-sized project", mainly because I already 
have various bits of code that handle the fiddly byte/str offset conversions.

--

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-07-06 Thread Peter Ludemann


Peter Ludemann  added the comment:

Looking at the suggested successor tools (redbaron, libCST, parso, awpa) ... 
all of them appear to use some variant of pgen2. But at some point Python will 
be using a PEG approach (PEP 617), and therefor the pgen2 approach apparently 
won't work.

For a number of projects, it's important to have a parse tree that contains all 
the "whitespace" information (indent, dedent, comment, newline, etc.) As far as 
I can tell, the new PEG parser won't provide that, and it seems that none of 
the successor tools will be able to handle future versions of Python syntax.

So, three questions:
1. Am I right that all proposed replacements (redbaron, libCST, parso, awpa) 
use some variation of the LL(1) and therefore will have trouble in the future?
2. Are there any plans (either part of the core development or as a project) 
for one of these replacements that is PEG-based? (Or a new project?)
3. Is Lib/ast.py going to continue being supported? (I infer that it will, with 
the change from LL(1) to PEG being mostly transparent - 
https://mail.python.org/archives/list/python-...@python.org/thread/HOZ2RI3FXUEMAT4XAX4UHFN4PKG5J5GR/#4D3B2NM2JMV2UKIT6EV5Q2A6XK2HXDEH
 )

If Lib/ast.py continues to be supported, I think I can see a way of providing 
functionality similar to lib2to3 (in terms of an AST-ish thing with 
"whitespace" from the source, sufficient for tools such as yapf, black, 
pykythe, pytype, mypy, etc.) as a kind of wrapper to ast.py. 
I suppose I should discuss this idea on python-dev? Is there an ongoing 
discussion? (I couldn't find any but might have been using the wrong search 
terms)

--

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



[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2020-07-05 Thread Peter Wu


Peter Wu  added the comment:

I just ran into this issue on Linux when piping a binary file to stdin resulted 
in a UnicodeDecodeError while trying to read a byte from the stream. Passing 
/dev/stdin is a workaround that does not require modifications to an 
application.

As for the proposed PR 13165, I'd suggest to gracefully fallback to normal 
stdout/stdin if the buffer is not available. That approach is also followed in 
the fileinput module, and takes care of the note for library developers in the 
documentation at https://docs.python.org/3/library/sys.html#sys.stdin

Not feeling particular strong about the graceful handling, but I hope that the 
test code can be simplified in that case.

--
nosy: +lekensteyn

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



[issue33327] Add a method to move messages to IMAPlib

2020-07-03 Thread Hans-Peter Jansen


Hans-Peter Jansen  added the comment:

If I'm not mistaken, this is applied to the openSUSE TW version of Python. 
For some reason, this seems to not play well with .uid('move',...)
on a cyrus imap server (v2.4.19). Is that to be expected?

```
2020-07-03 18:04:05  INFO: [imap_reorg] move b'10399' from 2017-01-01 
06:30:35+02:00 to INBOX.2017
Traceback (most recent call last):
  File "./imap_reorg.py", line 431, in 
sys.exit(main())
  File "./imap_reorg.py", line 425, in main
return process()
  File "./imap_reorg.py", line 133, in trace_and_call
result = func(*args, **kwargs)
  File "./imap_reorg.py", line 358, in process
ret |= reorg.run_expr(expr)
  File "./imap_reorg.py", line 345, in run_expr
return method(*args)
  File "./imap_reorg.py", line 328, in yearly
ret = self.imap.uid('move', uid, dest)
  File "/usr/lib64/python3.8/imaplib.py", line 881, in uid
typ, dat = self._simple_command(name, command, *args)
  File "/usr/lib64/python3.8/imaplib.py", line 1205, in _simple_command
return self._command_complete(name, self._command(name, *args))
  File "/usr/lib64/python3.8/imaplib.py", line 1030, in _command_complete
raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: UID command error: BAD [b'Unrecognized UID subcommand']
```

--
nosy: +frispete

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



[issue41163] test_weakref hangs

2020-06-29 Thread Peter Kuťák

New submission from Peter Kuťák :

Command make hangs on test_weakref 
I compile python 3.6.11 (latest compatible with my settings raspbian jessie)
I compile on OrangePi i96 - single core ARM 

I think it is same problem as Issue29796

--
components: Tests
messages: 372605
nosy: Peter Kuťák
priority: normal
severity: normal
status: open
title: test_weakref hangs
type: compile error
versions: Python 3.6

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



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2020-06-28 Thread Peter Law


Change by Peter Law :


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

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



[issue41147] Document that redirect_std{out, err} yield the new stream as the context variable

2020-06-28 Thread Peter Law


New submission from Peter Law :

In `contextlib`, `_RedirectStream` (the class behind `redirect_stdout` and 
`redirect_stderr`) returns the current stream target as its context variable, 
which allows code like this:

``` python
with redirect_stdout(io.StringIO()) as buffer:
do_stuff()

use(buffer.getvalue())
```

where you capture the redirected stream without a separate line to declare the 
variable.

This isn't documented (See 
https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stdout), 
yet is potentially useful.

Unless there's a reason that this isn't documented, I propose that the 
documentation be modified to include it.

Aside: After initially reporting this against the typeshed 
(https://github.com/python/typeshed/issues/4283) I'm also working on a PR to 
the typeshed to include this there.

--
assignee: docs@python
components: Documentation
messages: 372513
nosy: PeterJCLaw, docs@python
priority: normal
severity: normal
status: open
title: Document that redirect_std{out,err} yield the new stream as the context 
variable
type: behavior

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



[issue40540] inconstent stdin buffering/seeking behaviour

2020-05-06 Thread Peter Law


New submission from Peter Law :

`sys.stdin` (on Windows, tested Pythons 3.6-3.8) appears to have different 
seeking behaviour depending on the source of the incoming data. This seems 
arguably reasonable given that `stdin` isn't always seekable, however even in 
the failing case `sys.stdin.seekable()` returns `True`.

Given the `reader.py` source:

``` python
import sys


def coding_check(lines, default='utf-8'):
for line_number, line in enumerate(lines, 1):
print((line_number, line))
if line_number > 2:
break
return default


stdin = sys.stdin
print(stdin.seekable())

stdin.seek(0)

coding_check(stdin)

stdin.seek(0)
print(stdin.read())
```

then for two similar invocations we get differing results:

```
> python reader.py < reader.py
True
(1, 'import sys\n')
(2, '\n')
(3, '\n')
import sys


def coding_check(lines, default='utf-8'):

<... etc. redacted for brevity>

>
```

```
> type reader.py | python reader.py
True
(1, 'import sys\n')
(2, '\n')
(3, '\n')

>
```

I realise that raw standard input isn't always seekable, however I would hope 
that in the case that it isn't seekable that `.seekable()` would tell us that.

I also tried wrapping `stdin.buffer` in an `io.BufferedReader` and using that, 
however for short files (three lines or less) this issue is still present. I'm 
not sure if this is something I'm misunderstanding around buffered readers, a 
variation on this issue or another issue though.

--
components: Windows
messages: 368306
nosy: PeterJCLaw, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: inconstent stdin buffering/seeking behaviour
type: behavior

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

The documentation change gives two possible successors:

https://libcst.readthedocs.io/ (https://github.com/Instagram/LibCST)
https://parso.readthedocs.io/

And I've also seen this mentioned: https://github.com/pyga/awpa

Is it possible to settle on one of these as the successor to the lib2to3 
parser? It would be nice to avoid a 2nd deprecation in the future ...

--

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-27 Thread Peter Ludemann


Change by Peter Ludemann :


--
nosy: +Peter Ludemann

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



[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-04-08 Thread Peter Lovett


Change by Peter Lovett :


--
nosy: +PeterL777

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



[issue39615] cpython/abstract.h not compatible with C90

2020-03-24 Thread Peter Eisentraut


Peter Eisentraut  added the comment:

3.9.0a5 fixes my original issue.  Thanks.

--

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



[issue40047] itertools.tee does not release resources during iteration?

2020-03-23 Thread Peter Würtz

New submission from Peter Würtz :

Itertools `tee` does not seem to de-reference yielded items, even after 
consumption of all items from all tee-iterators.

According to the documentation (to my understanding), there shouldn't be any 
extra memory requirement as long as the tee-iterators are consumed in a 
balanced way. I.e. after an item was pulled from all iterators there shouldn't 
be any residual reference to it.

This is true for the example-implementation mentioned in the documentation, but 
`itertools.tee` doesn't de-reference items until the tee-iterator itself is 
deleted:

https://pastebin.com/r3JUkH41

Is this a bug or am I missing something?

--
components: Library (Lib)
messages: 364849
nosy: pwuertz
priority: normal
severity: normal
status: open
title: itertools.tee does not release resources during iteration?
type: resource usage
versions: Python 3.7

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



[issue40012] Avoid Python 2 documentation to appear in Web search results

2020-03-19 Thread Peter Bittner


New submission from Peter Bittner :

Currently, when you do a Web search (e.g. using Google, Bing, Yahoo!, 
DuckDuckGo, et al.) for a Python module or function call you'll find a link to 
the related Python 2 documentation first.

How to reproduce:

1. Search for simply "os.environ" in your favorite search engine.
2. Find a link to the Python documentation in the first 3 results. Typically, 
this will point to the Python 2 docs first.

(Side note: Google seems to now actively manipulate the results ranking Python 
3 results higher. Apparently, this is the only popular search engine behaving 
like that.)

Expected result:

- When searching for Python modules, functions, builtins, etc. on the Web, no 
search results for Python 2 should pop up at all if the same content exists for 
Python 3

Possible implementation:

- Add a "noindex" meta tag to the header of the generated HTML documentation
- see https://support.google.com/webmasters/answer/93710

--
messages: 364597
nosy: bittner
priority: normal
severity: normal
status: open
title: Avoid Python 2 documentation to appear in Web search results
type: enhancement
versions: Python 2.7

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



[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Peter Otten


Peter Otten <__pete...@web.de> added the comment:

This is not a bug (and if it were you would have to report to numpy, not 
cpython).

Consider:

>>> import numpy
>>> a = numpy.zeros((2,2,2))
>>> a[0,2]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: index 2 is out of bounds for axis 1 with size 2

This is probably the message you expect. However, if you write
>>> a[0][2]
Traceback (most recent call last):
  File "", line 1, in 
IndexError: index 2 is out of bounds for axis 0 with size 2

you split the operation into two steps, and the second axis of a is effectively 
the first axis of a[0].

--
nosy: +peter.otten -steven.daprano

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



[issue39615] cpython/abstract.h not compatible with C90

2020-02-12 Thread Peter Eisentraut


Peter Eisentraut  added the comment:

That's fair for code internal to CPython itself, but these are header files 
included by third-party code that is embedding Python, so a bit more 
flexibility and adaptability would be welcome there.

--

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



[issue39615] cpython/abstract.h not compatible with C90

2020-02-12 Thread Peter Eisentraut


Change by Peter Eisentraut :


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

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



[issue39615] cpython/abstract.h not compatible with C90

2020-02-12 Thread Peter Eisentraut


New submission from Peter Eisentraut :

Some inline functions use mixed declarations and code.  These end up visible in 
third-party code that includes Python.h, which might not be using a C99 
compiler.

Example:

In file included from 
/Users/peter/python-builds/3.9/include/python3.9/abstract.h:843,
 from 
/Users/peter/python-builds/3.9/include/python3.9/Python.h:147,
 from plpython.h:59,
 from plpy_typeio.h:10,
 from plpy_cursorobject.h:8,
 from plpy_cursorobject.c:14:
/Users/peter/python-builds/3.9/include/python3.9/cpython/abstract.h:74:5: 
warning: ISO C90 forbids mixed declarations and code 
[-Wdeclaration-after-statement]
   74 | Py_ssize_t offset = tp->tp_vectorcall_offset;
  | ^~

--
components: Interpreter Core
messages: 361880
nosy: petere
priority: normal
severity: normal
status: open
title: cpython/abstract.h not compatible with C90
versions: Python 3.9

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



[issue39391] Run-dependent Pydoc output for functions default parameters

2020-01-31 Thread Peter O.


Peter O.  added the comment:

Is this bug tracker the correct place to "ask the pydoc developers to add an 
option to improve [the Pydoc] output", in the sense that the option doesn't 
write out object IDs?  If not, where is the correct place to do so?

--

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



[issue39391] Nondeterministic Pydoc output on functions that have functions as default parameters

2020-01-27 Thread Peter O.


Peter O.  added the comment:

No, the use case I have in mind is storing outputs of the pydoc3 program -- as 
is -- in version control systems such as Git (e.g., running a command like 
"pydoc3 mymodule > mymodule_doc.txt").  The pydoc3 output is not further parsed 
by programs, or even "tested".

For example, adding "#doctest: +ELLIPSIS" as in the following example does not 
solve the problem in the opening post:


def testfunc(a, m=d0): #doctest: +ELLIPSIS
   pass

--
resolution: not a bug -> 
status: closed -> open

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



[issue39340] shutil.rmtree and write protected files

2020-01-27 Thread Peter Liedholm


Peter Liedholm  added the comment:

What I would expect is a consistent behaviour and as a user I am not interested 
in inner guts of differences between filesystems.
Regards
/Peter

--

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



[issue1812] doctest _load_testfile function -- newline handling seems incorrect

2020-01-21 Thread Peter Donis


Peter Donis  added the comment:

Pinging as a reminder that there is a pull request for this issue awaiting 
review.

--

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



[issue39391] Nondeterministic Pydoc output on functions that have functions as default parameters

2020-01-19 Thread Peter Occil


New submission from Peter Occil :

It appears that if a method has default parameters set to functions, as in this 
example:

def f1():
pass

def f2(a, b=f1):
pass

The resulting Pydoc output produces a different, nondeterministic rendering for 
the f2 method each time it generates the documentation, such as `m1(a, 
b=)` or `m1(a, b=)`.  And this is problematic for version control systems, among 
other things, especially since this is not a meaningful change to the 
documentation.

One solution may be to write, say, `m1(a, b=f1)` instead.

--
assignee: docs@python
components: Documentation
messages: 360278
nosy: Peter Occil, docs@python
priority: normal
severity: normal
status: open
title: Nondeterministic Pydoc output on functions that have functions as 
default parameters
type: behavior

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



[issue39383] Mention Darwin as a potential value for platform.system()

2020-01-18 Thread Peter Bittner


New submission from Peter Bittner :

The platform module's documentation mentions 'Linux', 'Windows' and 'Java' 
explicitly as values for `platform.system()`.

https://docs.python.org/3/library/platform.html#platform.system

Given the popularity of macOS among developers, this gives the impression that 
the module won't detect 'Darwin' as a separate system type; developers may 
suspect this will be identified also as a "Linux-y" system (or so).

Hence, 'Darwin' should be mentioned explicitly as one of the possible values.

--
assignee: docs@python
components: Documentation
messages: 360248
nosy: bittner, docs@python
priority: normal
pull_requests: 17448
severity: normal
status: open
title: Mention Darwin as a potential value for platform.system()
type: enhancement
versions: Python 3.9

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



[issue39340] shutil.rmtree and write protected files

2020-01-15 Thread Peter Liedholm


New submission from Peter Liedholm :

Ubuntu 18.4 and Windows 7 has different behaviour when deleting write protected 
files with rmtree.

Ubuntu silently deletes them (unexpected?)
Windows moans about access denied (expected?)

Reproduction method linux
mkdir test; touch test/file.txt; chmod -w test/file.txt

Reproduction method windows
mkdir test && type nul > test\file.txt && attrib +R test\file.txt

Reproduction method cont.
python3 -c "import shutil; shutil.rmtree('test')"

--
components: Library (Lib)
messages: 360033
nosy: PeterFS
priority: normal
severity: normal
status: open
title: shutil.rmtree and write protected files
versions: Python 3.6, Python 3.8

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



[issue39327] shutil.rmtree using vagrant synched folder fails

2020-01-14 Thread Peter Liedholm


Peter Liedholm  added the comment:

Problem is also reported in virtualbox
https://www.virtualbox.org/ticket/19004

>From that ticket some more analysis is done;
strace reveals that Python has kept an open fd for the directory being removed.

--

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



[issue39327] shutil.rmtree using vagrant synched folder fails

2020-01-14 Thread Peter Liedholm


New submission from Peter Liedholm :

Python 3.6.9
Ubuntu 18.04
python3 -c 'import shutil; shutil.rmtree("1a")'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/shutil.py", line 486, in rmtree
_rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 428, in _rmtree_safe_fd
onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.6/shutil.py", line 426, in _rmtree_safe_fd
os.rmdir(name, dir_fd=topfd)
OSError: [Errno 26] Text file busy: '4a'
-
Reproduction method
mkdir synched_folder\1a\2a\3a\4a
mkdir synched_folder\1a\2b\3a\4a
mkdir synched_folder\1b\2a\3a\4a
choco install vagrant
Save Vagrantfile in empty folder
vagrant box add ubuntu/bionic64
vagrant up
vagrant ssh
cd synched_folder
python3 -c 'import shutil; shutil.rmtree("1a")'
*** Error message ***
rm -r 1a
*** Works fine ***

--
components: Library (Lib)
files: Vagrantfile
messages: 359961
nosy: PeterFS
priority: normal
severity: normal
status: open
title: shutil.rmtree using vagrant synched folder fails
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48838/Vagrantfile

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



[issue38623] Python documentation should mention how to find site-packages

2020-01-07 Thread Peter Bittner


Peter Bittner  added the comment:

Python learners deserve to know about "site-packages" and (optionally) 
"dist-packages". This is a "random note", it's an explanation that is missing 
in the tutorial.

- Site-packages "is the target directory of manually built Python packages", 
does someone explain.[4]

- It is the "expected convention for locally installed packages", explains Greg 
Ward in "Installing Python Modules".[5]

- Their location is only a subset of `sys.path`, as visible from the Python 
code in the `site` module.[6]

The tutorial currently mentions its special role only briefly [7], saying:

> * The installation-dependent default.

We should explain that part. I'll give it a shot replacing my earlier proposal.


[4] 
https://stackoverflow.com/questions/31384639/what-is-pythons-site-packages-directory
[5] https://docs.python.org/3.8/install/#modifying-python-s-search-path
[6] https://github.com/python/cpython/blob/master/Lib/site.py#L319-L344
[7] 
https://docs.python.org/3.8/tutorial/modules.html?highlight=installation-dependent%20default#the-module-search-path

--

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



[issue38623] Python documentation should mention how to find site-packages

2020-01-06 Thread Peter Bittner


Peter Bittner  added the comment:

There is a specific question this change attempts to answer: "Where is the 
module I imported located in the file system?"

I suspect this comes up a lot because developers want to inspect or mess with 
installed modules, add debug output and the like, to understand some of their 
development issues better.

The site module documentation explains the details.[3] The paragraph the change 
adds links to that documentation. That should be sufficient (for a tutorial); 
other technical details probably fit well in the document being linked to.

[3] https://docs.python.org/3/library/site.html#site.getusersitepackages

I tried to keep it concise, adding value with a quick glance over the `site` 
module features that relate to the module paths topic.

--

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



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

To clarify and fix a typo ... lib2to3.pgen2.tokenize.detect_encoding checks for 
'utf-8'(and 'utf_8') but not 'utf8' in various places. Similarly for 'latin-1' 
and 'latin1'. (The codecs documentation page allows 'utf8' and 'latin1' as 
codecs.)

['UTF-8' is taken care of in _get_normal_name] 

See also https://bugs.python.org/issue39155

--

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



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

(oops -- updated this bug instead of submitting a new one)
See also https://bugs.python.org/issue39155

--

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



[issue39155] "utf8-sig" missing from codecs (inconsistency)

2019-12-29 Thread Peter Ludemann


New submission from Peter Ludemann :

In general, 'utf8' and 'utf-8' are interchangeable in the codecs (and in many 
parts of the Python library). However, 'utf8-sig' is missing ... and it happens 
to also be generated by lib2to3.tokenize.detect_encoding.

>>> import codecs
>>> codecs.getincrementaldecoder('utf-8-sig')()

>>> codecs.getincrementaldecoder('utf8-sig')()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/codecs.py", line 987, in getincrementaldecoder
decoder = lookup(encoding).incrementaldecoder
LookupError: unknown encoding: utf8-sig

------
components: Unicode
messages: 358996
nosy: Peter Ludemann, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: "utf8-sig" missing from codecs (inconsistency)
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue39154] "utf8" not always a synonym for "utf-8" in lib2to3

2019-12-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

lib2to3.tokenize should allow 'utf8' and 'utf-8' interchangeably, to be 
consistent with the rest of the Python library (I looked through the library 
source, and there seems to be no consistent preference, and also many (but not 
all) checks for 'utf-8' also check for 'utf8'). In particular, 
tokenize.detect_encoding should have code for both forms, as the encoding can 
be set by the user. Also, code should allow for 'UTF8' and 'UTF-8'.

See also https://bugs.python.org/issue39154

(This is probably a larger issue than just lib2to3, as a quick grep through 
/usr/lib/python3.7 showed; but not sure how to best address that.)

--
components: +2to3 (2.x to 3.x conversion tool) -Unicode
title: "utf8-sig" missing from codecs (inconsistency) -> "utf8" not always a 
synonym for "utf-8" in lib2to3

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



[issue39154] "utf8-sig" missing from codecs (inconsistency)

2019-12-29 Thread Peter Ludemann


New submission from Peter Ludemann :

In general, 'utf8' and 'utf-8' are interchangeable in the codecs (and in many 
parts of the Python library). However, 'utf8-sig' is missing ... and it happens 
to also be generated by lib2to3.tokenize.detect_encoding.

>>> import codecs
>>> codecs.getincrementaldecoder('utf-8-sig')()

>>> codecs.getincrementaldecoder('utf8-sig')()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/codecs.py", line 987, in getincrementaldecoder
decoder = lookup(encoding).incrementaldecoder
LookupError: unknown encoding: utf8-sig

------
components: Unicode
messages: 358994
nosy: Peter Ludemann, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: "utf8-sig" missing from codecs (inconsistency)
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue1812] doctest _load_testfile function -- newline handling seems incorrect

2019-11-25 Thread Peter Donis


Change by Peter Donis :


--
versions: +Python 3.9 -Python 2.7, Python 3.4, Python 3.5

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



[issue1812] doctest _load_testfile function -- newline handling seems incorrect

2019-11-25 Thread Peter Donis


Peter Donis  added the comment:

I have submitted pull request #17385 regarding this issue:

https://github.com/python/cpython/pull/17385

--

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



[issue1812] doctest _load_testfile function -- newline handling seems incorrect

2019-11-25 Thread Peter Donis


Change by Peter Donis :


--
pull_requests: +16867
pull_request: https://github.com/python/cpython/pull/17385

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



[issue38633] shutil.copystat fails with PermissionError in WSL

2019-10-29 Thread Peter


New submission from Peter :

Using shutil.copystat (and therefore also shutil.copytree) in WSL on any 
directories from a mounted Windows drive (i.e. /mnt/c/...) raises an 
shutil.Error "[Errno 13] Permission denied". 

It seems to fail when copying the extended filesystem attribute 
"system.wsl_case_sensitive" using os.setxattr() here: 
https://github.com/python/cpython/blob/da6ce58dd5ac109485af45878fca6bfd265b43e9/Lib/shutil.py#L322

Note that this only happens when both src and dst are on the mounted drive. If 
only one is on the drive and the other is e.g. in the home directory 
/home/username/, it will not raise an error. 

Quick way to test: 

cd /mnt/c/ && mkdir test1 && mkdir test2 && python -c "import shutil; 
shutil.copystat('test1', 'test2')"

--
components: Library (Lib), Windows
messages: 355655
nosy: paul.moore, pspeter, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: shutil.copystat fails with PermissionError in WSL
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue38623] Python documentation should mention how to find site-packages

2019-10-28 Thread Peter Bittner


Change by Peter Bittner :


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

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



[issue38623] Python documentation should mention how to find site-packages

2019-10-28 Thread Peter Bittner


New submission from Peter Bittner :

A popular question on StackOverflow is, "How do I find the location of my 
Python site-packages directory?" [1]

While this may hint at a deeper problem that needs to be solved, a user 
suggested [2] the accepted answer to be added to Python's official 
documentation.

The most appropriate place I could find to add related information is 
``Doc/tutorial/modules.rst``.

[1] 
https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory/46071447
[2] 
https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory/46071447#comment103247041_46071447

--
assignee: docs@python
components: Documentation
messages: 355599
nosy: bittner, docs@python
priority: normal
severity: normal
status: open
title: Python documentation should mention how to find site-packages
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue38551] lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes

2019-10-23 Thread Peter Ludemann


Peter Ludemann  added the comment:

issue36541 and its proposed PR seem to cover my needs.

--
stage:  -> resolved
status: open -> closed

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-10-23 Thread Peter Ludemann


Peter Ludemann  added the comment:

Also the Grammar.txt diffs look about the same size as I've seen with other 
upgrades to lib2to3 when the Python grammar changed.

--

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



[issue38551] lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes

2019-10-21 Thread Peter Ludemann


Peter Ludemann  added the comment:

Should I just close this? (I didn't find https://bugs.python.org/issue36541 
when I searched, possibly because I used "2to3" instead of "lib2to3" in my 
search.)

--

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-10-21 Thread Peter Ludemann


Peter Ludemann  added the comment:

Re: breakage due to changes in structure 
(https://bugs.python.org/issue36541#msg339669) ... this has already happened in 
the past (e.g., type annotations and async). 

It's probably a good idea to add some documentation that structure changes can 
be expected with each release of Python.

--
nosy: +Peter Ludemann

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



[issue38551] lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes

2019-10-21 Thread Peter Ludemann


New submission from Peter Ludemann :

As far as I can tell, the lib2to3/Grammar.txt file in the Python 3.8 release is 
the same as that of the Python 3.7 release, which means it doesn't have the 
"walrus" operator and the "/" parameter syntax.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 355092
nosy: Peter Ludemann
priority: normal
severity: normal
status: open
title: lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes
type: behavior
versions: Python 3.8

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



[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-08-15 Thread Peter Edwards


Peter Edwards  added the comment:

On Wed, 14 Aug 2019 at 23:13, STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> About PR 13649, I'm not sure that _PyThread_preferred_stacksize() is still
> relevant, since my change fixed test_faulthandler test_register_chain(). I
> chose my change since it's less invasive: it only impacts faulthandler, and
> it minimalizes the memory usage (especially when faulthandler is not used).
>

Sure - there's no reason for it to exist if you don't want to use it to fix
the issue here.

> Python/thread_pthread.h refactor changes of PR 13649 are interested. Would
> you like to extract them into a new PR which doesn't add
> _PyThread_preferred_stacksize() but just add new PLATFORM_xxx macros?
>

Yes, certainly.

Maybe test_faulthandler will fail tomorrow on a new platform, but I prefer
> to open a discussion once such case happens, rather than guessing how
> faulthandler can crash on an hypothetical platforms.

Well, one argument for the dynamic approach is that existing python
binaries can adjust without needing to be respun for new CPUs. I think
SIGSTKSZ is a vestage from when CPU architectures had consistently sized
register sets across models.  Its interesting to read the comment on the
IA64 definition for SIGSTKSZ:

https://github.com/torvalds/linux/blob/master/arch/ia64/include/uapi/asm/signal.h#L83

> I'm sure that libc developers are well aware of the FPU state size and
> update SIGSTKSZ accordingly.
>

The current value comes from the kernel sources, and has not changed since
at the latest 2005 (with the initial git commit of the kernel), which I
think predates xsave/xrestore by some margin. I don't think its a useful
measure of anything in the real (x86) world today.

> glibc code computing xsave_state_size:
>
>
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/cpu-features.c;h=4bab1549132fe8a4c203a70b8c7a51c1dc304049;hb=HEAD#l223
>
> --
>
> If tomorrow, it becomes too hard to choose a good default value for
> faulthandler stack size, another workaround would be to make it
> configurable, as Python lets developers choose the thread stack size:
> _thread.stack_size(size).
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue21131>
> ___
>

--

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



[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-08-15 Thread Peter Edwards


Peter Edwards  added the comment:

On Wed, 14 Aug 2019 at 22:32, STINNER Victor  wrote:

>
> We are talking abou the faulthandler_user() function of
> Modules/faulthandler.c. It is implemented in pure C, it doesn't allocate
> memory on the heap, it uses a very small set of functions (write(),
> sigaction(), raise()) and it tries to minimize its usage of the stack
> memory.
>

I was more concerned about what was happening in the chained handler, which
will also run on the restricted stack: I had assumed that was potentially
running arbitrary python code. That's actually probably incorrect, now that
I think about it, but it's harder to infer much about its stack usage
directly in faulthandler.c. I'll take a look (just to satisfy myself, more
than anything)

> It is very different than the traceback module which is implemented in
> pure Python.
>

Right, totally - I had jumped to the conclusion that it would end up
executing in the interpreter via the chain, but, as I say, that's probably
wrong. I'm not sure what guarantees the chained signal handler makes about
its stack usage. (Will educate myself)

> faulthandler is really designed to debug segmentation fault, stack
> overflow, Python hang (like a deadlock), etc.

> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue21131>
> ___
>

--

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



  1   2   3   4   5   6   7   >