[issue35276] Document thread safety

2020-08-24 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
nosy: +sir-sigurd

___
Python tracker 

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



[issue41630] Visual Studio does not build the curses and curses.panel module

2020-08-24 Thread Maarten


Change by Maarten :


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

___
Python tracker 

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



[issue41630] Visual Studio does not build the curses and curses.panel module

2020-08-24 Thread Maarten


New submission from Maarten :

When building python using Visual Studio, the curses and curses.module, are not 
getting built.

--
components: Build, Library (Lib)
messages: 375871
nosy: maarten
priority: normal
severity: normal
status: open
title: Visual Studio does not build the curses and curses.panel module

___
Python tracker 

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



[issue41534] argparse : allow_abbrev behavior between 3.7 and 3.8

2020-08-24 Thread paul j3


paul j3  added the comment:

In your first example:

In [29]: parser = argparse39.ArgumentParser(allow_abbrev=True)  
In [30]: parser.add_argument('-o'); 

In [32]: parser.parse_known_args(['-o','test']) 
Out[32]: (Namespace(o='test'), [])

In [33]: parser.parse_known_args(['-object','test'])
Out[33]: (Namespace(o='bject'), ['test'])

Here the '-object' is interpreted as '-o' flag, with value the rest of the 
string.  That's normal behavior for a short option.

In [34]: parser.parse_known_args(['-o','test1','-object','test2'])  
Out[34]: (Namespace(o='bject'), ['test2'])

Same thing only '-object' has overwritten the 'test1' value.

In your second example:

In [39]: parser = argparse39.ArgumentParser(allow_abbrev=False) 
In [40]: parser.add_argument('-verbose');   

In [42]: parser.parse_known_args(['-v', '-verbose=2'])  
usage: ipython3 [-h] [-verbose VERBOSE]
ipython3: error: argument -verbose: expected one argument

Expected uses:

In [46]: parser.parse_known_args(['-verbose','two'])
Out[46]: (Namespace(verbose='two'), [])
In [47]: parser.parse_known_args(['-verbose=2'])
Out[47]: (Namespace(verbose='2'), [])

The '-ver' is not accepted as abbreviation:

In [48]: parser.parse_known_args(['-ver=2'])
Out[48]: (Namespace(verbose=None), ['-ver=2'])

'allow_abbrev' doesn't have effect because of '-verbose'

If instead I define '--verbose', I can turn the abbrev on/off:

In [49]: parser = argparse39.ArgumentParser(allow_abbrev=False) 
In [50]: parser.add_argument('--verbose');  
In [51]: parser.parse_known_args(['-ver=2'])
Out[51]: (Namespace(verbose=None), ['-ver=2'])
In [52]: parser.parse_known_args(['--ver=2'])   
Out[52]: (Namespace(verbose=None), ['--ver=2'])
In [53]: parser.allow_abbrev=True   
In [54]: parser.parse_known_args(['--ver=2'])   
Out[54]: (Namespace(verbose='2'), [])

There are a lot of variations to examine here.  The original, the 3.7, and 3.8 
versions.  abbrev False or True.  Proper long option (--), improper etc.

--

___
Python tracker 

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



[issue41598] Adding support for rounding modes to builtin round

2020-08-24 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Okay Marco, I'm changing the title to reflect the new API (support for rounding 
modes rather than new round functions) and pushed the version to 3.10, since 
3.9 is in feature freeze (no new features).

This will probably need to be discussed on Python-Ideas, and maybe a PEP 
written, but provided it is not too controversial it may not be a big 
complicated PEP and I'm happy to help.

There is certainly a history of people requesting something like this:

https://kingant.net/2019/01/rounding-numbers-in-python-2-and-python-3/

https://mail.python.org/archives/list/python-...@python.org/thread/34QNDXZBMP6RR4P6NZFFIJK6YODEWSVK/


It will help very much if Mark, Raymond and Tim either support this idea or at 
least don't object. (Adding Tim to the nosy list.)

See also relevant discussion here:

https://bugs.python.org/issue32956


In my innocence, I don't think that this will be a very difficult feature to 
implement. Out of the five IEEE-754 rounding modes:

- Round to nearest, ties away to even already exists, so no extra work needs to 
be done.

- Round to nearest, ties away from zero was already implemented in Python 2, so 
we can just(?) resurrect that.

- Round toward 0 (truncation or chop) is equivalent to rounding down for 
positive numbers and rounding up for negatives, so if we can implement those, 
we get round towards 0.

- And I think that rounding up and rounding down are symmetrical, so if you can 
do one, you can do the other.

As Vedran correctly points out, the tricky part is adjusting for the difference 
between decimal digits and bits.

Dotnet provides rounding modes for Math.Round:

https://docs.microsoft.com/en-us/dotnet/api/system.midpointrounding?view=netcore-3.1


So does Julia:

http://www.jlhub.com/julia/manual/en/function/round

http://www.jlhub.com/julia/manual/en/function/get_rounding


so I think that there is precedence for this in other languages.

--
nosy: +tim.peters
title: rnd() + rndup() in math -> Adding support for rounding modes to builtin 
round
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Done!

Thank you.

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



[issue41513] High accuracy math.hypot()

2020-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 8e19c8be87017f6bef8e4c936b1e6ddacb558ad2 by Raymond Hettinger in 
branch 'master':
bpo-41513:  More accurate hypot() (GH-21916)
https://github.com/python/cpython/commit/8e19c8be87017f6bef8e4c936b1e6ddacb558ad2


--

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-24 Thread Tim Peters


Tim Peters  added the comment:

Do it! It's elegant and practical :-)

--

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

All the review comments have been addressed.  I think it is a good as it can 
get.  Any objections to committing the PR?

--

___
Python tracker 

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



[issue41628] All unittest.mock autospec-generated methods are coroutine functions

2020-08-24 Thread Tom Most


Tom Most  added the comment:

Note that this can interact poorly with AsyncMock, introduced in Python 3.8, 
because it causes a mock generated from a mock produces an object with async 
methods rather than regular ones. In Python 3.7 chaining mocks like this would 
produce regular methods. (This is how I discovered this issue.)

--

___
Python tracker 

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



[issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__?

2020-08-24 Thread mike bayer


New submission from mike bayer :

This is likely related or a dupe of https://bugs.python.org/issue29270, but the 
error message is different.  I'm posting this to confirm it's the same issue, 
or not, and to at least provide a google result for people who also see this 
error as 29270 seems to imply this might not be fixable.

Like 29270, it involves the fact that the interpreter seems to be looking at my 
super() call inside of a method without actually calling it, and then getting 
upset about __classcell__:



from typing import NamedTuple


class X(NamedTuple):
a: str
b: str

# comment this out to remove the issue
def foo(self):
return super(X, self)


and that's it!  on my interpreter:

Python 3.8.3 (default, May 23 2020, 16:34:37) 
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux

I get:

$ python test3.py 
Traceback (most recent call last):
  File "test3.py", line 4, in 
class X(NamedTuple):
RuntimeError: __class__ not set defining 'X' as . Was 
__classcell__ propagated to type.__new__?

The most surprising thing is that this seems extremely basic and google is not 
finding this error message for me.

--
components: Interpreter Core
messages: 375863
nosy: zzzeek
priority: normal
severity: normal
status: open
title: __class__ not set defining 'X' as . Was 
__classcell__ propagated to type.__new__?
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



[issue41628] All unittest.mock autospec-generated methods are coroutine functions

2020-08-24 Thread Tom Most


New submission from Tom Most :

Given a class:

class Foo:
def bar(self):
pass

And an autospec'd mock of it:

foo_mock = mock.create_autospec(spec=Foo)

The result of `asyncio.iscoroutinefunction()` differs:

asyncio.iscoroutinefunction(Foo.bar)# -> False
asyncio.iscoroutinefunction(foo_mock.bar)   # -> True

This behavior is the same on Python 3.7 and 3.8.

I've attached a demonstration script, repro4.py. Here is the output on Python 
3.7.9:

$ python3.7 repro4.py 
baz is a coroutine function?False
Foo.bar is a coroutine function?False
foo_instance.bar is a coroutine function?   False
baz_mock is a coroutine function?   False
foo_mock.bar is a coroutine function?   True
foo_mock_instance.bar is a coroutine function?  True
foo_mock_mock.bar is a coroutine function?  False
foo_mock_mock_instance.bar is a coroutine function? False
foo_mock_instance.bar()  ->  
foo_mock_mock_instance.bar() ->  

And on Python 3.8.2:

python3.8 repro4.py 
baz is a coroutine function?False
Foo.bar is a coroutine function?False
foo_instance.bar is a coroutine function?   False
baz_mock is a coroutine function?   False
foo_mock.bar is a coroutine function?   True
foo_mock_instance.bar is a coroutine function?  True
foo_mock_mock.bar is a coroutine function?  True
foo_mock_mock_instance.bar is a coroutine function? False
foo_mock_instance.bar()  ->  
foo_mock_mock_instance.bar() ->  

--
components: Library (Lib)
files: repro4.py
messages: 375862
nosy: twm
priority: normal
severity: normal
status: open
title: All unittest.mock autospec-generated methods are coroutine functions
type: behavior
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49425/repro4.py

___
Python tracker 

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



[issue41616] Global variable in whole project and Relative imports problem

2020-08-24 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-08-24 Thread Steve Dower


Steve Dower  added the comment:

Any input from the asyncio experts?

I don't have an issue with handling the exception in this case, and hopefully 
when someone is up to the task of dealing with the range of edge cases 
throughout this loop implementation, hopefully they can get the ordering of 
waits right.

--
nosy: +steve.dower
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue41627] Relocate user site packages on Windows 32-bit

2020-08-24 Thread Steve Dower


New submission from Steve Dower :

Currently, the user site packages on Windows is %APPDATA%\Python\PythonXY. This 
can cause conflicts between the 32-bit and 64-bit versions of the runtime.

We should switch the pattern to Python{sys.winver}, which is XY or XY-32, the 
same as elsewhere.

This is a breaking change to tools that try to manage these directly, but it 
shouldn't need a deprecation cycle (there isn't really anywhere to raise a 
warning...). So I think we can just update Lib/sysconfig.py and Lib/site.py for 
3.10, as well as the docs.

--
components: Windows
messages: 375860
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Relocate user site packages on Windows 32-bit
versions: Python 3.10

___
Python tracker 

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



[issue38533] v3.7.5 py script run ok with python.exe but not pythonw.exe (python silent console not working)

2020-08-24 Thread Steve Dower


Steve Dower  added the comment:

Assuming the fix for this was released, given lack of other information.

--
resolution:  -> fixed
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



[issue41376] site.getusersitepackages() incorrectly claims that PYTHONNOUSERSITE is respected

2020-08-24 Thread Steve Dower


Change by Steve Dower :


--
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


Added file: https://bugs.python.org/file49424/hypot_flow.pdf

___
Python tracker 

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



[issue13828] Further improve casefold documentation

2020-08-24 Thread Jim Jewett

Jim Jewett  added the comment:

Unicode probably won't make the correction, because of backwards
compatibility.  I do support the sentence suggested in Thorsten's most
recent reply.  Is expanding ligatures the only other normalization it does?

Ideally, we should also mention that it shifts to the canonical case, which
is usually (but not always) lowercase.  I think Cherokee is one that folds
to the upper case.

On Mon, Aug 24, 2020 at 11:02 AM Thorsten  wrote:

>
> Thorsten  added the comment:
>
> I see. I found the documents. That's an issue. That usage is incorrect. It
> is still valid to upper case "ß" to SS since "ẞ" is fairly new as an
> official German character, but the other way around is not valid.
>
> As such the current sentence in documentation also just does not make
> sense.
>
> >"Since it is already lowercase, lower() would do nothing to 'ß'"
>
> Exactly. Why would it? It is nonsensical to change an already lowercase
> character with a lowercase function.
>
> Suggest to update to:
>
> "For example, the Unicode standard for German lower case letter 'ß'
> prescribes full casefolding to 'ss'. Since it is already lowercase, lower()
> would do nothing to 'ß'; casefold() converts it to 'ss'.
> In addition to full lowercasing, this function also expands ligatures, for
> example, 'fi' becomes 'fi'."
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> I don't recall the subtle differences between sendfile() and splice().

Basically, splice() is specialized for pipes:


splice() only works if one of the file descriptors refer to a pipe. So you can 
use for e.g. socket-to-pipe or pipe-to-file without copying the data into 
userspace. But you can't do file-to-file copies with it.

sendfile() only works if the source file descriptor refers to something that 
can be mmap()ed (i.e. mostly normal files) and before 2.6.33 the destination 
must be a socket.

--

___
Python tracker 

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



[issue41617] __builtin_bswap16 is used without checking it is supported

2020-08-24 Thread STINNER Victor


STINNER Victor  added the comment:

> Older clang versions don't have __builtin_bswap16,

According to https://github.com/nodejs/node/pull/7644 it's available in clang 
3.2 but not in clang 3.0.

I wrote PR 21949 to fix the issue: it only uses __has_builtin() if __clang__ is 
defined, it's different than PR 21942.

--

___
Python tracker 

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



[issue41617] __builtin_bswap16 is used without checking it is supported

2020-08-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +21059
pull_request: https://github.com/python/cpython/pull/21949

___
Python tracker 

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



[issue41626] port shebang of tools from python2 to python3

2020-08-24 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue41626] port shebang of tools from python2 to python3

2020-08-24 Thread hai shi


New submission from hai shi :

After the EOL of python2, the shebang of tools should be ported from python2 to 
python3.

some files like: 
https://github.com/python/cpython/blob/master/Objects/typeslots.py#L1

--
messages: 375855
nosy: shihai1991
priority: normal
severity: normal
status: open
title: port shebang of tools from python2 to python3
versions: Python 3.10

___
Python tracker 

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



[issue38378] os.sendfile() has improperly named parameter

2020-08-24 Thread STINNER Victor


STINNER Victor  added the comment:

Well, since os.sendfile(in=fd) raises a syntax error, I don't think that it's 
really a backward incompatible change in practice.

--

___
Python tracker 

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



[issue38378] os.sendfile() has improperly named parameter

2020-08-24 Thread STINNER Victor


STINNER Victor  added the comment:

I would prefer "2. Make "out" and "in" positional-only parameters". It would be 
a minor incompatible change, but it would make os.sendfile() more consistent 
with other functions like os.write() which only has positional-only parameters.

--
nosy: +vstinner

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-24 Thread STINNER Victor


STINNER Victor  added the comment:

I don't recall the subtle differences between sendfile() and splice(). I recall 
that in early Linux versions, one was limited to sockets, and only on one side. 
But later, it became possible to pass two sockets, or one file on disk and one 
socket, etc.

Python exposes sendfile() as os.sendfile() since Python 3.3:
https://docs.python.org/dev/library/os.html#os.sendfile

--
nosy: +vstinner

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-24 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
assignee:  -> pablogsal
components: +Library (Lib)
versions: +Python 3.10

___
Python tracker 

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



[issue41625] Add splice() to the os module

2020-08-24 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

The splice system call moves data between two file descriptors without copying 
between kernel address space and user address space.  This can be a very useful 
addition for libraries implementing low-level file management.

--
messages: 375851
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Add splice() to the os module

___
Python tracker 

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



[issue39603] [security] http.client: HTTP Header Injection in the HTTP method

2020-08-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +21056
pull_request: https://github.com/python/cpython/pull/21946

___
Python tracker 

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



[issue31526] Allow setting timestamp in gzip-compressed tarfiles

2020-08-24 Thread Maarten


Maarten  added the comment:

My previous comment should have contained:

Because I noticed the timestamp was not included in the CRC,
...

--

___
Python tracker 

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



[issue31526] Allow setting timestamp in gzip-compressed tarfiles

2020-08-24 Thread Maarten


Maarten  added the comment:

I have the same issue.
The timestamp is inserted here:
https://github.com/python/cpython/blob/802726acf6048338394a6a4750835c2cdd6a947b/Lib/tarfile.py#L419-L420

Because I noticed the timestamp was not included in the timestamp,
I could zero it by doing:
```
with open(gzipped_tarball,"r+b") as f:
f.seek(4, 0)
f.write(b"\x00\x00\x00\x00")
```

--
nosy: +maarten

___
Python tracker 

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



[issue41534] argparse : allow_abbrev behavior between 3.7 and 3.8

2020-08-24 Thread r1kk3r


r1kk3r  added the comment:

Another issue:

parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-verbose', type=int, required=True, dest="bla", help="bla")
known_args, rest_of_args = parser.parse_known_args(["-v", "-verbose=2"])

With python 3.8.5

test.py: error: argument -verbose: expected one argument

With python 3.7.8




This is really annoying. Argparse tries to do "smart" things where it 
shouldn't. I want it to parse -verbose, I never told him that -v is an alias 
for -verbose...

--

___
Python tracker 

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



[issue13828] Further improve casefold documentation

2020-08-24 Thread Thorsten

Thorsten  added the comment:

I see. I found the documents. That's an issue. That usage is incorrect. It is 
still valid to upper case "ß" to SS since "ẞ" is fairly new as an official 
German character, but the other way around is not valid.

As such the current sentence in documentation also just does not make sense.

>"Since it is already lowercase, lower() would do nothing to 'ß'"

Exactly. Why would it? It is nonsensical to change an already lowercase 
character with a lowercase function.

Suggest to update to:

"For example, the Unicode standard for German lower case letter 'ß' prescribes 
full casefolding to 'ss'. Since it is already lowercase, lower() would do 
nothing to 'ß'; casefold() converts it to 'ss'.
In addition to full lowercasing, this function also expands ligatures, for 
example, 'fi' becomes 'fi'."

--

___
Python tracker 

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



[issue41624] typing.Coroutine documentation

2020-08-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. This seems to be a reasonable suggestion. Would you like 
to open a PR for this?

--
keywords: +easy, newcomer friendly
nosy: +xtreak

___
Python tracker 

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



[issue41623] What's the by-design behavior when os.fork() is invoked in an asyncio loop?

2020-08-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

As you,can tell from thencode this by design. The child,must create a new event 
loop explicitly,ifmitmwants to use asyncio, and all,existing Futures are off 
limits.

Fork is dangerous. Don't use unless you understand it.

--
nosy: +gvanrossum
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



[issue13828] Further improve casefold documentation

2020-08-24 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Correctness of casefolding is defined by the Unicode standard, which currently 
states that "ß" folds to "ss".

--

___
Python tracker 

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



[issue41621] defaultdict miss behave when using default_factory passed as kwargs

2020-08-24 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

PR 21945 changes the signature:

- defaultdict(default_factory[, ...])
+ defaultdict(default_factory=None, /, [...])

--

___
Python tracker 

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



[issue13828] Further improve casefold documentation

2020-08-24 Thread Thorsten

Thorsten  added the comment:

German example in casefolding is plain incorrect.

#Casefolding is similar to lowercasing but more aggressive because it is 
#intended to remove all case distinctions in a string. For example, the #German 
lowercase letter 'ß' is equivalent to "ss". Since it is already #lowercase, 
lower() would do nothing to 'ß'; casefold() converts it to #"ss".

It is not true that "ß" is equivalent to "ss" and has not been since an 
orthography reform in 1996. These are to be used in distinct use cases. "ß" 
after a diphthong or a long/open vowel. "ss" after a short/closed vowel. The 
documentation correctly describes (in this case) how Python handles the 
.casefold() for this letter, although the behavior itself is incorrect.

As mentioned before, in 2017 an official upper-case version of "ß" has been 
introduced into German orthography: "ẞ". The German example should be stated as 
current incorrect behavior in the documentation.

+1 to adding previously mentioned sentence: In addition to lowercasing, this 
function also expands ligatures, for example, "fi" becomes "fi".

--
nosy: +MrSupertash

___
Python tracker 

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



[issue41621] defaultdict miss behave when using default_factory passed as kwargs

2020-08-24 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
keywords: +patch
nosy: +Dennis Sweeney
nosy_count: 3.0 -> 4.0
pull_requests: +21055
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21945

___
Python tracker 

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



[issue41624] typing.Coroutine documentation

2020-08-24 Thread MingZhe Hu


New submission from MingZhe Hu :

The documentation [1] for Coroutine in typing library writes:

class typing.Coroutine(Awaitable[V_co], Generic[T_co T_contra, V_co])

which should be:

class typing.Coroutine(Awaitable[V_co], Generic[T_co, T_contra, V_co])

a comma is missed between the first type variable T_co and the second one 
T_contr.

[1] https://docs.python.org/3/library/typing.html#typing.Generic

--
assignee: docs@python
components: Documentation
messages: 375841
nosy: Elaphurus, docs@python
priority: normal
severity: normal
status: open
title: typing.Coroutine documentation
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue41621] defaultdict miss behave when using default_factory passed as kwargs

2020-08-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

This is intentional behaviour, the factory can only be passed as a positional 
argument.

The documentation[1] mentions this, although its probably possible to write 
this a bit clearer.

[1] https://docs.python.org/3.8/library/collections.html#collections.defaultdict

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue41623] What's the by-design behavior when os.fork() is invoked in an asyncio loop?

2020-08-24 Thread simin lin


New submission from simin lin :

I have the same quesion in stackoverflow. Please refer to
https://stackoverflow.com/questions/63558555/whats-the-by-design-behavior-when-os-fork-is-invoked-in-an-asyncio-loop
to get a better format.


Does asyncio work with os.fork()?

Code Snippet 1:

import asyncio
import os

import aiohttp


async def main():
url = "https://google.com;
pid = os.fork()
if pid == 0:
# child process
print("in child process")
await fetch(url)
print("in child process done")
else:
print("in parent process")
await asyncio.sleep(20)
print("in parent process done")


async def fetch(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.text()

if __name__ == "__main__":
asyncio.run(main())
Code above works fine.

Code Snippet 2:

import asyncio
import os

import aiohttp


async def main():
url = "https://google.com;
pid = os.fork()
if pid == 0:
# child process
print("in child process")
await asyncio.sleep(10)  # different with code snippet 1
# await fetch(url)
print("in child process done")
else:
print("in parent process")
await asyncio.sleep(20)
print("in parent process done")


async def fetch(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.text()

if __name__ == "__main__":
asyncio.run(main())
Code above will raise following exception:

Traceback (most recent call last):
  File "fork_sleep.py", line 28, in 
asyncio.run(main())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in 
run_until_complete
return future.result()
  File "fork_sleep.py", line 13, in main
await asyncio.sleep(10)  # different with code snippet 1
  File "/usr/lib/python3.8/asyncio/tasks.py", line 637, in sleep
loop = events.get_running_loop()
RuntimeError: no running event loop
The reason for the "no running event loop" exception is that function 
get_running_loop compare the os.getpid() and the pid saved in loop. When they 
are different, the exception above is raised.

Please refer to the following code from cpython source code.

def get_running_loop():
"""Return the running event loop.  Raise a RuntimeError if there is none.

This function is thread-specific.
"""
# NOTE: this function is implemented in C (see _asynciomodule.c)
loop = _get_running_loop()
if loop is None:
raise RuntimeError('no running event loop')
return loop


def _get_running_loop():
"""Return the running event loop or None.

This is a low-level function intended to be used by event loops.
This function is thread-specific.
"""
# NOTE: this function is implemented in C (see _asynciomodule.c)
running_loop, pid = _running_loop.loop_pid
if running_loop is not None and pid == os.getpid():
return running_loop
So it seems that asyncio event loop works fine in child process if you don't 
touch the function get_running_loop. My question is, what is the by-design 
behavior? Why the author check the pid in function _get_running_loop? And what 
is the solution if you encounter the "no running event loop" in child process.

--
components: asyncio
messages: 375839
nosy: asvetlov, linsm08, yselivanov
priority: normal
severity: normal
status: open
title: What's the by-design behavior when os.fork() is invoked in an asyncio 
loop?
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



[issue41597] Fatal Error on SSL Transport - sslv3 alert bad record mac

2020-08-24 Thread Mototsugu Emori


Mototsugu Emori  added the comment:

Thank you for your reply.
I understand that websocket cannot be used in multiple threads.
I close the issue.

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



[issue41596] Re: Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range

2020-08-24 Thread Mototsugu Emori


Mototsugu Emori  added the comment:

Thank you for your reply.
I understand that websocket cannot be used in multiple threads.
I close the issue.

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



[issue41566] Include much faster DEFLATE implementations in Python's gzip and zlib libraries. (isa-l)

2020-08-24 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

> If you take this route, please don't write it directly against the CPython 
> C-API (as you would for a CPython stdlib module).

Thanks for reminding me of this. I was planning to take the laziest route 
possible anyway, reusing as much code from cpython as possible.

I will probably start with a minimal implementation of these base classes 
https://github.com/python/cpython/blob/master/Lib/_compression.py using cython, 
using the gzip implementation in cpython as guidance.

--

___
Python tracker 

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