[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-38858: Allocate small integers on the heap (GH-17301)

I associated this change to this issue because I had troubles when I tried to 
call _PyLong_Fini() in subinterpreters. I'm now trying to have different small 
integers per interpreter.

--

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5dcc06f6e0d7b5d6589085692b86c63e35e2325e by Victor Stinner in 
branch 'master':
bpo-38858: Allocate small integers on the heap (GH-17301)
https://github.com/python/cpython/commit/5dcc06f6e0d7b5d6589085692b86c63e35e2325e


--

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

After PR 17302 is accepted, I'll work on refactorings including a precedence 
algorithm to find when to parentheses.

--
nosy: +Batuhan Taskaya

___
Python tracker 

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



[issue38863] Improve is_cgi() in http.server

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

@martin.panter, @asvetlov

I add the core developers who looks like to be experts on this module.
Can you follow up on Siwon's PR?

Thanks for your understanding.

--
nosy: +asvetlov, martin.panter
versions:  -Python 3.6

___
Python tracker 

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



[issue38863] Improve is_cgi() in http.server

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks, Siwon Kang, I now understood what you want to say.
I left some comments on your PR 17312.

--

___
Python tracker 

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



[issue38863] Improve is_cgi() in http.server

2019-11-20 Thread Siwon Kang


Siwon Kang  added the comment:

Hi Donghee,
Since you said this is not a bug, I changed the title describing this is a 
matter of improvement.

For your comment, I would say sorry first that I have made you confused. My 
mention about apache is just to give you an example for the other module that 
does similar thing(HTTP request handler with cgi support). I would never say 
the Python server shall support the sub-directory parsing for cgi scripts 
because apache does but I am saying good is good.

>> Yes, IMHO, but this code is related to the http.server.CGIHTTPRequestHandler.
This code looks like to be executed on the http.server.CGIHTTPRequestHandler 
not the apache server.

So you may see the PR changes the CGIHTTPRequestHandler class. Please refer to 
the code.

>> According to docs,
This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as 
containing CGI scripts.

This is the one I was looking at. As described, I added '/sub/dir/cgi-bin' into 
the cgi_directories expecting it to be treated the directory is for CGI scripts 
but the CGIHTTPRequestHandler does not process it. That is the reason for this 
issue report. Again, there is no note that restrict the path in cgi_directories 
shall be a single depth, so I think this will definitely give a benefit to 
handle the multi-level directories just like https://bugs.python.org/issue21323 
enables processing the sub directories of /cgi-bin.
Does this make sense to you now?

--
title: http.server is_cgi() does not correctly separate dir -> Improve is_cgi() 
in http.server
type: behavior -> enhancement

___
Python tracker 

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



[issue38688] Python 3.8 regression: endless loop in shutil.copytree

2019-11-20 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

PR-17098 basically reverts https://bugs.python.org/issue33695. Not good. =) 
I think we can simply consume the iterator immediately as in:

def copytree(src, ...):
with os.scandir(src) as itr:
entries = list(itr)
return _copytree(entries=entries, ...)

--

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
pull_requests:  -16785

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
pull_requests: +16800
pull_request: https://github.com/python/cpython/pull/17312

___
Python tracker 

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



[issue38871] lib2to3 generates invalid code with filter and ternary operator

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

I can reproduce on the latest master branch.

./python Tools/scripts/2to3 2.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored 2.py
--- 2.py(original)
+++ 2.py(refactored)
@@ -1,3 +1,3 @@
 data = [1, 2, 3, 4, 5]
-x = filter(lambda x: True if x > 2 else False, data)
+x = [x for x in data if True if x > 2 else False]
 print(x)
RefactoringTool: Files that need to be modified:
RefactoringTool: 2.py

--
nosy: +corona10

___
Python tracker 

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



[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-20 Thread Junyeong Jeong


Junyeong Jeong  added the comment:

> The items that haven't finished the put aren't actually "in" the queue yet, 
> so I don't see how non-FIFO order of insertion violates any FIFO guarantees 
> for the contents of the queue; until the items are actually "in", they're not 
> sequenced for the purposes of when they come "out". Mandating such a 
> guarantee effectively means orchestrating a queue with a real maxsize equal 
> to the configured maxsize plus the total number of coroutines competing to 
> put items into it.

Your explanation is correct technically. But without enough explanation, this
behavior can confuse many users.

For instance it happens to put data into asyncio.Queue at asyncio protocol
callbacks by creating new task. This logic will work nicely for a long time but
in the corner case the queue gets full and at the point of view of a consumer
the data come out from the queue are out of order.

IMHO, it would be better to add some note into the document, describing what
FIFO means in regard to asyncio.Queue.

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

(Don't wait for me, I am preoccupied with other things this week.)

--
title: UDP sockets created by create_datagram_endpoint() allow by default  
multiple processes to bind the same port -> UDP sockets created by 
create_datagram_endpoint() allow by default multiple processes to bind the same 
port

___
Python tracker 

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



[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-20 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

The items that haven't finished the put aren't actually "in" the queue yet, so 
I don't see how non-FIFO order of insertion violates any FIFO guarantees for 
the contents of the queue; until the items are actually "in", they're not 
sequenced for the purposes of when they come "out". Mandating such a guarantee 
effectively means orchestrating a queue with a real maxsize equal to the 
configured maxsize plus the total number of coroutines competing to put items 
into it.

The guarantee is still being met here; once an item is put, it will be "get"-ed 
after anything that finished put-ing before it, and before anything that 
finished put-ing after it.

--
nosy: +josh.r

___
Python tracker 

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



[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-20 Thread Junyeong Jeong


New submission from Junyeong Jeong :

Hi

The python document says that asyncio.Queue is FIFO queue. But it is not true
when the queue is full and multi tasks are putting items into it
simultaneously. I know the document does not explicitly mention that
asyncio.Queue is multi producer queue, but also there does not exist any note
that it may be corrupt if used by multi producers.

I found the below scenario happens when the asyncio.Queue is full and multi
tasks are putting into it simultaneously. Let me explain this.

When a queue is full, putters are awaiting here: 
https://github.com/python/cpython/blob/d67279147ace3b63187e5d75a15c345264f39e85/Lib/asyncio/queues.py#L125

And the first of them is waken up here: 
https://github.com/python/cpython/blob/d67279147ace3b63187e5d75a15c345264f39e85/Lib/asyncio/queues.py#L188

Before the first putter hands over the control of execution, new putter
calls the .put() method so the queue is not full at this point that it calls
.put_nowait() immediately here: 
https://github.com/python/cpython/blob/d67279147ace3b63187e5d75a15c345264f39e85/Lib/asyncio/queues.py#L140

If this happens the new putter puts earlier than other awaiting putters.

I hope the queue gets fixed to work correctly in this case.

Thanks,

  Junyeong

--
components: asyncio
messages: 357129
nosy: asvetlov, esrse, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.Queue: putting items out of order when it is full
versions: Python 3.7

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Oh in that case, would you like me to close or modify GH-17311? I didn't 
> think you'd approve of making the more extensive changes all the way back to 
> 3.5.

After reading the comments here I think Antoine's solution makes sense. But... 
let's wait a bit to see what other people say.  My comment is just a single +1; 
maybe Andrew, Nathaniel, or Guido have arguments against it.

--
stage: patch review -> 

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Change by Kyle Stanley :


--
stage:  -> patch review

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Yeah, I like this prposal; we can apply this to all Python's from 3.5 to 3.8. 
>  With a proper documentation update this should be OK.

Oh in that case, would you like me to close or modify GH-17311? I didn't think 
you'd approve of making the more extensive changes all the way back to 3.5.

--
stage: patch review -> 

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Change by Kyle Stanley :


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

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> My preference for create_datagram_endpoint() would be:

> - make the "reuse_address" parameter a no-op, and raise an error when 
> "reuse_address=True" is passed

> - do that in 3.8 as well

Yeah, I like this prposal; we can apply this to all Python's from 3.5 to 3.8.  
With a proper documentation update this should be OK.

--

___
Python tracker 

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



[issue38873] find_library for libcrypto and libssl on Catalina returns the unversioned library

2019-11-20 Thread Sarah Harvey


New submission from Sarah Harvey :

I've been tracking this through a bunch of different projects now. With the 
release of Mac OS X Catalina, libcrypto.dylib is a dummy library that causes an 
automatic segfault, to prevent upstream software from relying on it.

However a large amount of software makes use of ctypes find_library() which 
will return the path to the unversioned library.

It would be nice if we could specify "find the latest version" or similar so 
that we don't have to manually munge in a version, especially for strongly 
cross-platform libraries such as oscrypto.

I've filed a similar bug here https://github.com/wbond/oscrypto/issues/35 where 
it's very clear how it manifests itself.

--
components: ctypes
messages: 357125
nosy: worldwise001
priority: normal
severity: normal
status: open
title: find_library for libcrypto and libssl on Catalina returns the 
unversioned library
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Kyle Stanley  added the comment:

> My preference for create_datagram_endpoint() would be:

> - make the "reuse_address" parameter a no-op, and raise an error when 
> "reuse_address=True" is passed

> - do that in 3.8 as well

This solution would more elegant, but my concern is that it will leave open a 
substantial security concern for versions 3.5, 3.6, and 3.7 if we only applied 
that to 3.8 and 3.9. Although Nathaniel's suggestion would ultimately make the 
`reuse_address` parameter fairly meaningless (essentially converting it into an 
alias for `reuse_port`), it would fix the security issue while still 
maintaining backwards compatibility for most users, allowing us to backport it 
all the way back to 3.5.

Perhaps this could lead to a deprecation warning or error, and then an eventual 
removal of `reuse_address`, but I think that's more of a long term concern for 
3.9+.

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I'd like to point out that it is also documented completely wrong up to this 
> point in time and thus people who chose True are most likely to be unaware of 
> the actual consequences. A user's explicit choice based on misinformation is 
> not really demonstrating intent to shoot oneself in the foot.

That's why I'm in favor of making the internal change from `SO_REUSEADDR` to 
`SO_REUSEPORT` (as Nathaniel suggested) and raising a warning for an explicit 
`reuse_address=True` (as Antoine suggested). If someone has a genuine need for 
using SO_REUSEADDR, they can do so manually.

This will patch the issue without any maintenance cost to users that didn't 
explicitly pass `reuse_address=True`, and raise a warning if they did pass it. 
The majority of users seem to have done did the former, which would make sense. 
Compare the following GitHub code search results:

All usage of `loop.create_datagram_endpoint`: 
https://github.com/search?q=%22loop.create_datagram_endpoint%22=Code 
(~3,500 Python results)

Usage of `loop.create_datagram_endpoint` + `reuse_address=True`: 
https://github.com/search?q=%22loop.create_datagram_endpoint%22+%22reuse_address%3DTrue%22=Code
 (~650 Python results)

Note: the second set of results contains some false positives due to usage of 
`reuse_address=True` for something else in the same code file. So, the actual 
number is likely less.

> I'm still attached to the idea that in 3.10 reuse_address and reuse_port are 
> both removed

IIUC, there's only a security concern with the usage of `SO_REUSEADDR`, not 
`SO_REUSEPORT`. So there's no need at all to remove or deprecate the 
`reuse_port` parameter. 

> (Provisionally marking this as a security-related deferred blocker issue for 
> backporting)

Thanks, Ned.

--

___
Python tracker 

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



[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset d5d41d39366214c9628b2680fa18fb8d085bcdbc by Miss Islington (bot) 
in branch '3.8':
bpo-36277: Add document for pdb debug and retval commands (GH-12872)
https://github.com/python/cpython/commit/d5d41d39366214c9628b2680fa18fb8d085bcdbc


--

___
Python tracker 

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



[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 97c301bfc5ea278c32dc5fabe425d8981ec5d3b1 by Miss Islington (bot) 
in branch '3.7':
bpo-36277: Add document for pdb debug and retval commands (GH-12872)
https://github.com/python/cpython/commit/97c301bfc5ea278c32dc5fabe425d8981ec5d3b1


--

___
Python tracker 

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



[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@Antony.Lee, thank you for the report, @remi.lapeyre, thank you for the 
research, and @dvnguyen, thank you for the PR.

--
nosy: +cheryl.sabella
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



Re: Use epoll but still lose packet

2019-11-20 Thread lampahome
Dennis Lee Bieber  於 2019年11月21日 週四 上午2:17寫道:

> On Wed, 20 Nov 2019 18:51:31 +0800, lampahome 
> declaimed the following:
>
> >
> >I only use a while loop to catch events like below:
> >import select, socket
> >sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> >sock.bind()
>
> Documentation indicates that one must provide an address (ip,
> port) for
> the bind -- there is no default described.
>
> sorry, I just write a brief code so I don't write whole detail ex: (ip,
port). But it can receive any connection and bind successfully.


> >sock.listen(10)
>
> You've specified that 10 connections can be held in the backlog,
> any
> beyond that will be refused.
>
> But there's one client and it send 128 messages with different length.


> for fd,event in events:
> >  if event & select.EPOLLIN:
> >sock.recv(1024)
> >...
>
> Documentation is a bit week -- there is no description of what
> .poll()
> returns in the help file.
>
> Point #1: you are using STREAM => implies TCP. TCP is not a
> "message"
> related protocol. Multiple "sends" can be one "receive" packet. One "send"
> can also be multiple "receive" packets. You truncated anything that would
> show if your processing is parsing out some high-level protocol showing the
> handling of such combined or split packets.
>
> Maybe this is the point! Multiple sends which doesn't full a 1024-length
buffer will make me receive one packet.


> Also, the help system links to
> https://linux.die.net/man/4/epoll
> which has
> """
> Q7
> If more than one event comes in between epoll_wait(2) calls, are they
> combined or reported separately?
> A7
> They will be combined.
> """
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16797
pull_request: https://github.com/python/cpython/pull/17308

___
Python tracker 

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



[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16798
pull_request: https://github.com/python/cpython/pull/17309

___
Python tracker 

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



[issue36277] pdb's recursive debug command is not listed in the docs

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 9391f6c3ef24f7962c534c42ccb792debdbef509 by Miss Islington (bot) 
(Dave Nguyen) in branch 'master':
bpo-36277: Add document for pdb debug and retval commands (GH-12872)
https://github.com/python/cpython/commit/9391f6c3ef24f7962c534c42ccb792debdbef509


--
nosy: +miss-islington

___
Python tracker 

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



[issue38872] Document exec symbol for codeop.compile_command

2019-11-20 Thread Cheryl Sabella


New submission from Cheryl Sabella :

codeop.compile_command accepts 'exec' as a symbol, but it is not documented.  

Opening this bug report for an issue initially reported in PR3179.

--
assignee: docs@python
components: Documentation
messages: 357118
nosy: cheryl.sabella, docs@python
priority: normal
severity: normal
status: open
title: Document exec symbol for codeop.compile_command
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38021] pep425 tag for AIX is inadequate

2019-11-20 Thread Ned Deily


Ned Deily  added the comment:

PEP 425 tags are now in the Python Packaging Authority realm.  People from 
there should also be reviewing this issue and the new PR.  CC-ing Brett and 
Nick for guidance.

Also, assuming the feature is approved, I don't think it would be appropriate 
to backport to 3.7 (considering where 3.7 is in its life cycle).  It may be 
appropriate to make an exception for 3.8 since it is still early in its life.

--
nosy: +brett.cannon, ncoghlan
versions:  -Python 3.7

___
Python tracker 

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2019-11-20 Thread Lisa Roach


Change by Lisa Roach :


--
pull_requests: +16796
pull_request: https://github.com/python/cpython/pull/17304

___
Python tracker 

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



[issue38021] pep425 tag for AIX is inadequate

2019-11-20 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +16795
pull_request: https://github.com/python/cpython/pull/17303

___
Python tracker 

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2019-11-20 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 046442d02bcc6e848e71e93e47f6cde9e279e993 by Lisa Roach (Jason 
Fried) in branch 'master':
bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] 
(GH-17269)
https://github.com/python/cpython/commit/046442d02bcc6e848e71e93e47f6cde9e279e993


--

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2019-11-20 Thread Galen Han


Change by Galen Han :


--
nosy: +Galen Han

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Ned Deily


Ned Deily  added the comment:

(Provisionally marking this as a security-related deferred blocker issue for 
backporting)

--
nosy: +ned.deily
priority: normal -> deferred blocker
type: behavior -> security
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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset e5d1f734db135e284af8e8868e7ccc85355952b9 by Miss Islington (bot) 
(Brandt Bucher) in branch 'master':
bpo-38823: Clean up _xxtestfuzz initialization. (GH-17216)
https://github.com/python/cpython/commit/e5d1f734db135e284af8e8868e7ccc85355952b9


--

___
Python tracker 

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



Re: Can we use Python for hacking?

2019-11-20 Thread user
On Tue, 12 Nov 2019 08:49:44 +0400, Abdur-Rahmaan Janhangeer wrote:

> Greetings all,
> 
> Someone requested my answer to the question: "Can we use Python for
> hacking?"
> 
> I compiled some interesting tools and uses here .
> That's as far as i could see. If someone has more examples, he can
> share!
> 
> Yours,
> 
> Abdur-Rahmaan Janhangeer pythonmembers.club
>  | github
> 
> Mauritius

can you post more links for python interesting tools and uses?
any resource related with python and pentesting?

Thank you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread MRAB

On 2019-11-20 21:58, Terry Reedy wrote:

On 11/20/2019 11:09 AM, Göktuğ Kayaalp wrote:


The first problem is installation: apart from me, a Debian user,
everybody has Windows or Mac laptops, and IDK how you install Python on
them.


The simplest thing is to use the 3.8.0 python.org installers.  This use
pip to add anything you consider essential.

For Windows, I use "Windows x86-64 executable installer" for 64-bit and 
"Windows x86 executable installer" for 32-bit from 
https://www.python.org/downloads/windows/.

--
https://mail.python.org/mailman/listinfo/python-list


[issue17582] xml.etree.ElementTree does not preserve whitespaces in attributes

2019-11-20 Thread Emiliano Heyns


Emiliano Heyns  added the comment:

I don't see newlines currently preserved in attributes:

   elem = ET.parse(StringIO('')).getroot()
   print(ET.tostring(elem))

--
components:  -XML
nosy: +Emiliano Heyns
versions:  -Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue38871] lib2to3 generates invalid code with filter and ternary operator

2019-11-20 Thread Zoran Simic


New submission from Zoran Simic :

This code snippet exposes a small edge case in lib2to3, where syntactically 
invalid code is generated:

data = [1, 2, 3, 4, 5]
x = filter(lambda x: True if x > 2 else False, data)
print(x)


lib2to3 transforms 2nd line above to:
x = [x for x in data if True if x > 2 else False]


which is invalid (would be OK with parentheses after 1st 'if')

Admittedly, the original code here is more complex that it should be ('True if 
foo else False' being equivalent to just 'foo'), but walked into this in "the 
real world" and wanted to report it.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 357112
nosy: Zoran Simic
priority: normal
severity: normal
status: open
title: lib2to3 generates invalid code with filter and ternary operator
type: behavior
versions: 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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

After PR17302 is merged we need to fix the following cosmetic issues indicated 
by Victor:

(*) unparse adds many useless parentheses. The algorithm seems naive.
For example, it adds "()" to "class _AddedDllDirectory():". It also
adds parenthesis around yield, like "(yield (top, dirs, nondirs))",
whereas the AST node was at "top level": it isn't a sub-expression.
Maybe this algortihm should be made smarter.

(*) newlines in docstring are rendered as two characters: "\" + "n"
(escaped newline: \n), rather than a newline character. I would expect
a newline, it's more common that \n... But it may "break" inline
doctests rendering... Maybe it should be an option (render newlines as
newline character or escape them?), or maybe even let the user choose
how to render them using a callback (that's related to the "pluggable
formatter" question).

(*) Indentation is hardcoded to 4 spaces. What if I want 2 spaces or
something different? Should it become an option?

(*) Float infinity is replaces with 1e309. Again, maybe someone wants
to render this differently? It sounds like an arbitrary choice (which
"works" as expected).

--

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue38868] Shutil cannot delete a folder that contains an .ini file

2019-11-20 Thread Eryk Sun


Eryk Sun  added the comment:

What is the system error code (winerror) of the PermissionError?

--
nosy: +eryksun

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Jukka Väisänen

Jukka Väisänen  added the comment:

> We just chose an unfortunate default for one of them

I'd like to point out that it is also documented completely wrong up to this 
point in time and thus people who chose True are most likely to be unaware of 
the actual consequences. A user's explicit choice based on misinformation is 
not really demonstrating intent to shoot oneself in the foot.

So after changing my mind a couple of times I'm still attached to the idea that 
in 3.10 reuse_address and reuse_port are both removed and the tiny portion of 
developers who need them will just create a suitably setsockopt'd socket and 
pass it to the function. 2 lines of additional code is all it takes.

If the documentation had been correct all along and just the default bad, this 
mess would be much smaller.

--

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley


Kyle Stanley  added the comment:

> There are some platforms (Linux pre-3.9 kernels) that don't have 
> SO_REUSEPORT. I wish I could say I don't care about such platforms; alas, I 
> just had to compile Python 3.7 on a system running a 2.6 kernel last month at 
> a client site.

Based on https://www.kernel.org/releases.html, pre-3.9 Linux kernels are no 
longer supported upstream, the oldest LTS version is 3.16.

There are likely a number of systems running older unsupported kernel versions, 
but I don't think that we can be reasonably expected to maintain indefinite 
backwards compatibility to versions that aren't supported upstream, especially 
not at the expense of the ones that are supported. 

In those cases, I think the responsibility ultimately falls upon the owners of 
the system or third party group providing service. This particular fix would be 
fairly straightforward:

> And, yes, someone who really wants SO_REUSEADDR can set it manually, for 
> example by calling `transport.get_extra_info('socket')`.

--

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2019-11-20 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

As discussed in 
https://mail.python.org/archives/list/python-...@python.org/thread/JAQDBMC23HW2PQ27HQNJ7G244T423IDD/
 I propose to expose the unparse.py tool as part of the standard library in the 
ast module.

The exposed function will have the interface:

ast.unparse(ast_obj, *, option1, option2,...)

and will return a string with the unparsed version of ast_obj.

The unparse tool will need some cosmetic improvements that will be tracked 
separately in this issue.

--
assignee: pablogsal
components: Library (Lib)
messages: 357107
nosy: BTaskaya, pablogsal
priority: normal
severity: normal
status: open
title: Expose ast.unparse in the ast module
type: enhancement
versions: Python 3.9

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Abdur-Rahmaan Janhangeer
Besides the mistakes in the pdf (random.shuffle) the idea is to get the
right environment then py basics then numpy+pandas then viz seaborn or
minimal matplotlib

Abdur-Rahmaan Janhangeer
http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
Mauritius

On Thu, 21 Nov 2019, 00:49 Abdur-Rahmaan Janhangeer, 
wrote:

> I have a draft of a concise py book for data people which i am preparing,
> might be useful to you.
>
>
> https://drive.google.com/file/d/1IKLBuJJWQKvcTWu-REsgm-JUGSvytBUu/view?usp=drivesdk
>
> Abdur-Rahmaan Janhangeer
> http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
> Mauritius
>
> On Wed, 20 Nov 2019, 20:54 Göktuğ Kayaalp,  wrote:
>
>> Hi all,
>>
>> I am responsible of giving my colleagues in from linguistics MA
>> programme an intro to Python, and programming, with a focus on
>> statistics.  It’ll be a single lecture, and I probably won’t be able to
>> do more than give some demos and then some pointers to actually properly
>> learn how to use the tools.
>>
>> The problem is I’m a rather techie power user and my audience the exact
>> opposite, so I feel like I could make use of some guidance as to how to
>> bridge the gap and be useful.
>>
>> I want to stick to Python 3, demo them a few basics of programming, then
>> how to use matplotlib, Jupyter notebooks (is this what IPyNBs became?),
>> and some descriptive statistics.  All this needs to happen within the
>> span of a single lecture (tho if people are interested I’ll offer to do
>> a few more in our own time), so 45min~1h.
>>
>> The first problem is installation: apart from me, a Debian user,
>> everybody has Windows or Mac laptops, and IDK how you install Python on
>> them.  I feel like choosing one of the distros is a good idea: I could
>> just put the installers on a USB and hand it out, or just send them a
>> message with simple steps to follow and set themselves up beforehand.
>> Thing is, IDK nothing about distros.  Anaconda seems to be the best
>> options, but comes with complications like an IDE, as opposed to just
>> working with notebooks, and is huge.  Also, seems to include R stuff.
>> Spyder looks nice, but I don’t want to freak people out with such an
>> unfamiliar environment as an IDE just within the first few moments they
>> encounter programming.  These are all humanities people.  Another
>> problem is that Anaconda has ‘conda’, a non-standard package manager,
>> and I’m kinda vary of introducing that to people: should I talk of pip,
>> should I leave it out?  I feel like I should just stick to pip and leave
>> conda out, but IDK.  Python(x,y) is interesting, but it’s apparently
>> Py2k only, and that’s a no-no.
>>
>> So, am I better off telling people to install Anaconda, or plain Py3k +
>> a selection of packages (which maybe I make into a .zip or something)?
>>
>> Then, I need good pointers to hand out: links to good introductions to
>> Python, programming, and statistical use of Python.  Thing is, I’ve
>> always learned the hacker way, i.e. skip the docs, tinker with stuff.
>> Thus, IDK of any good resources out of experience, and I want to ask you
>> all for some recommendations.  I prefer free and tutorial-like stuff,
>> but I’ll teach them how to use the stdlib reference too.
>>
>> What are some good self-teaching material for those who are new to
>> programming and Python, and need to mainly do statistics with
>> experimental data?
>>
>> Finally, I’m looking for recommendations on what to show and how.  My
>> current master plan is
>>
>> - what’s the use of programming for a linguist
>> - an abstract idea of what programming is
>> - basic intro to Python syntax
>> - demo how to load and clean up some data
>> - demo matplotlib
>> - demo jupyter notebooks
>> - compare with alternatives: R, SPSS, other?
>> - briefly refer to libraries for
>>   - NLP
>>   - AI?
>> - lots of links on
>>   - how to learn enough coding for number crunching and plotmaking
>>   - how to make use of stdlib reference
>>   - how to find and utilise packages and their docs
>>   - ...?
>>
>> I plan to produce a handout with all this info neatly organised, and
>> just go with a (few) Jupyter notebooks for the rest (resisting hard the
>> urge to go in with Emacs Org Mode instead :)).
>>
>> I’m looking forward to any recommendations from youse.  The deadline is
>> about a month and a half away, and I really want to give people
>> something operationable.  People are stuck with BS like SPSS, too simple
>> and too pricy, when a few lines of Python (or R) is all they need.  I
>> came here because IDK teaching about this stuff, and I haven’t left the
>> comfort zones of a programmer ever before, so this is some new
>> experience for me and I don’t want to botch it.
>>
>> Thanks a lot in advance,
>>
>>Göktuğ.
>>
>> --
>> İ. Göktuğ Kayaalp   
>>  024C 30DD 597D 142B 49AC
>>  40EB 465C D949 B101 2427
>> --
>> 

Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Terry Reedy

On 11/20/2019 11:09 AM, Göktuğ Kayaalp wrote:


The first problem is installation: apart from me, a Debian user,
everybody has Windows or Mac laptops, and IDK how you install Python on
them.


The simplest thing is to use the 3.8.0 python.org installers.  This use 
pip to add anything you consider essential.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp
On 2019-11-20 16:03 -05, Andrew Z  wrote:
> Look into https://repl.it

Sadly this apparaently can’t do plots.

> On Wed, Nov 20, 2019, 15:43 Göktuğ Kayaalp  wrote:
>
>>
>> Andrew Z   wrote:
>> > Goktug,
>> >   Im not clear what is the objective of the lecture? I understand it is
>> an
>> > intro, but what are you trying to achieve?
>>
>> Basically I need to introduce my non-programmer friends to Python and
>> show them that they can easily learn to do their statistics with it,
>> produce nice graphs, etc.  And I need to give them nice pointers so that
>> they can self-teach w/o much friction.
>>
>> > I didnt read all the details, but maybe you can look into creating a
>> > docker/virtual box image with everything preinstalled.
>> > Good luck.
>>
>> That’d definitely be my cup of tea, but sadly also too involved /
>> technical for my audience of absolute non-techies.
>>
>> Cheers,
>>
>> -gk.
>>
>> --
>> İ. Göktuğ Kayaalp   
>>  024C 30DD 597D 142B 49AC
>>  40EB 465C D949 B101 2427
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
> [2:text/html Show Save:noname (5kB)]
>

-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16793
pull_request: https://github.com/python/cpython/pull/17301

___
Python tracker 

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



[issue38869] Unexpectedly variable result

2019-11-20 Thread Zachary Ware


Zachary Ware  added the comment:

I don't see anything here to indicate a bug in CPython or the standard library, 
so I'm closing the issue.  I would recommend asking for help with this on 
python-l...@python.org (comp.lang.python) or StackOverflow.  If you can reduce 
it to a bug in either numpy or cv2, you'll need to report it to the correct 
issue tracker for the project.

--
nosy: +zach.ware
resolution:  -> third party
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



[issue38869] Unexpectedly variable result

2019-11-20 Thread Ian Carr-de Avelon


New submission from Ian Carr-de Avelon :

I can't understand why the result of changes() in the example file changes. I 
get:
[[6.90642211e-310]
 [1.01702662e-316]
 [1.58101007e-322]]
[[0.]
 [0.]
 [0.]]
with an Ubuntu 14 system that has had a lot of changes made. I've checked the 
same happens on pythonanywhere.com so it does not seem to just be my system is 
broken. I wondered if there was some strange state in cv2 I don't know about, 
but as commenting out the tvec=np.zeros(3) line removes the behaviour I think 
there is something strange here. Now I've got it down to a few lines I can find 
a work around  and obviously numpy and opencv are huge packages and it may be 
in their court, but I think it is worth someone taking a look who knows more 
than me.
Yours
Ian

--
files: bug.py
messages: 357105
nosy: IanCarr
priority: normal
severity: normal
status: open
title: Unexpectedly variable result
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file48727/bug.py

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp
On 2019-11-20 13:29 -07, Akkana Peck  wrote:
> Chris Angelico writes:
>> On Thu, Nov 21, 2019 at 4:42 AM Nick Sarbicki  
>> wrote:
>> > RE Conda and distros - I'd forget about them, in my experience you may as
>> > well learn to use pip and install what you need that way, in the long term
>> 
>> Agreed. 
>
> More agreement. Someone at the local makerspace recently tried to
> teach a beginning Python class; the first hour and a half lecture
> was entirely devoted to trying to get Anaconda installed on
> everyone's machines, and most of the people still didn't have it
> installed by the end. I heard a lot of the people from the first
> lecture gave up and didn't come back for the second lecture because
> they still didn't have a working environment. Of the people who did
> return, I saw some of them (fairly technical users to begin with, just
> not in Python) later struggling with conda updates that went wrong.

Wow.  This was good to know, thanks a lot!

> Installing Python on Windows isn't trivial, but if you lead them
> through each of the steps (hint: be sure not to miss the small
> checkbox about adding Python to the path -- you have to scroll down
> to the bottom of the options list to see it, and it's not checked by
> default) it shouldn't be too bad. Also, have a copy of the installer
> available on a USB stick or three unless the lecture hall is
> guaranteed to have flawless wi-fi.

Again, great tip, thanks!

> Can you get a couple of Windows and Mac using friends (who don't
> already have Python) to help you try out the installers before the class?
> Or, for Windows, you could try one of these virtualbox images:
> https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

I’ve just asked my brother to try it out for me.  Later on, I’ll try
with my friends.

Thanks a lot for the link, I’ll try it out.

Cheers,

-gk.


-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp
Chris Angelico  wrote:
>On Thu, Nov 21, 2019 at 4:42 AM Nick Sarbicki  
>wrote:
>> RE Conda and distros - I'd forget about them, in my experience you may as
>> well learn to use pip and install what you need that way, in the long term
>> it is faster and more flexible. Python generally supplies a perfectly good
>> installer for most operating systems at python.org - no need for anything
>> else. Keeping it to just standard python (+ some libs you don't explicitly
>> need to explain) makes it less complex.
>
>Agreed. In fact, given the tight context here, I would go even further
>and stick to JUST the standard library - there's already way more in
>there than you need for a single lecture. Maybe just name-drop pip and
>hint at the fact that there's a lot more to Python than just what you
>see here, but other than that, keep it really simple.

I’d be extatic if I could do that, but AFAIK there are no plotting
libraries in the stdlib.  ‘statistics’ is nice, but lacks stuff we need
often as linguists, like chi^2, t-tests, correlations, (m)anova, 

>> In summary I'd aim to inspire not to teach - so show some basics at the
>> beginning to show how accessible it can be, and then feel free to jump off
>> into advanced python land to showcase what is possible using whatever you
>> are most comfortable with. Essentially show them they can learn python, and
>> then inspire them to want to learn python.
>>
>
>Absolutely agreed. Your job is not to turn them into programmers. Your
>job is just to inspire them - to show them possibilities, to excite
>them, to empower them to play.

Thanks!

-gk.

-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-20 Thread John Goerzen


John Goerzen  added the comment:

As has been pointed out to me, the surrogateescape method could be used here; 
however, it is a bit of an odd duckling itself, and the system's open() call 
accepts bytes; couldn't this as well?

--

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Andrew Z
Look into https://repl.it


On Wed, Nov 20, 2019, 15:43 Göktuğ Kayaalp  wrote:

>
> Andrew Z   wrote:
> > Goktug,
> >   Im not clear what is the objective of the lecture? I understand it is
> an
> > intro, but what are you trying to achieve?
>
> Basically I need to introduce my non-programmer friends to Python and
> show them that they can easily learn to do their statistics with it,
> produce nice graphs, etc.  And I need to give them nice pointers so that
> they can self-teach w/o much friction.
>
> > I didnt read all the details, but maybe you can look into creating a
> > docker/virtual box image with everything preinstalled.
> > Good luck.
>
> That’d definitely be my cup of tea, but sadly also too involved /
> technical for my audience of absolute non-techies.
>
> Cheers,
>
> -gk.
>
> --
> İ. Göktuğ Kayaalp   
>  024C 30DD 597D 142B 49AC
>  40EB 465C D949 B101 2427
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread David Cuthbert


David Cuthbert  added the comment:

On the completely deprecate reuse_address and rewrite/force folks to use 
reuse_port proposals, I'm a bit dubious of this approach.

Right now, we have two knobs that directly correspond to (potential) 
kernel-level socket parameters, SO_REUSEADDR and SO_REUSEPORT. We just chose an 
unfortunate default for one of them. Otherwise, the behavior is nicely explicit.

Rewriting or forbidding it, even when the user has (essentially) acknowledged 
they're accepting risks by passing reuse_address=True, seems to fly in the face 
of this. Users get bitten when we start convoluting logic here (I was just 
bitten by fcntl.lockf() not actually calling lockf() last month and ended up 
having to call lockf() via ctypes.).

There are some platforms (Linux pre-3.9 kernels) that don't have SO_REUSEPORT. 
I wish I could say I don't care about such platforms; alas, I just had to 
compile Python 3.7 on a system running a 2.6 kernel last month at a client site.

Finally, I've only scratched the surface with my test cases, on single-homed 
systems, IPv4, and binding to 0.0.0.0. There are a lot of parameters to try 
here before we decree that reuse_address has no purpose existing, and an OS 
could later reimplement saner defaults on SO_REUSEADDR.

Changing a default already has some controversy (Yury was -1 on this change). 
This seems much bigger and I'm not convinced we fully understand its 
ramifications.

That said, I'll happily implement whatever the consensus ends up being, or 
consensus as designated by the vBDFL, or wherever that decision needs to come 
from. :-)

--

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp
Nick Sarbicki  wrote:
> Hi Goktug,
>
> Firstly good luck, inspiring a crowd of people who have never learnt to
> code (and probably never expected to) to want to code sounds like a
> daunting task.
> 
> I think you have broadly the right idea in that you want to spend only a
> little bit of time on the basic syntax before demoing what you can do with
> the language. I would spend the beginning of the lecture focusing on how
> readable code can be - an attempt to make it less scary to people who
> haven't touched code before - and then spend the rest of the time showing
> the fun things you can do with it.

I’m lucky that when I introduced the idea, my peers were really excited
about it.  Readability is indeed a nice idea, because they are not
familiar with coding and don’t really know how straight forward a thing
it actually is, at least when all you’re trying to do is load some CSV
files and do some t-tests, chi^2, correlation, and plots.

> I can't see trying to take students from no code to competent SciPy users
> in one lecture as a possible feat. So it would be best to simply inspire
> them to want to learn more themselves. In which case I'd encourage you to
> have a think as to what would be the most inspiring examples? Are jupyter
> notebooks on their own something that inspires? Probably not - although
> they are nice for showcasing code in. Is ETL exciting? Maybe in extremely
> rare cases... NLP, AI etc can be pretty fun and powerful. Graphing
> libraries such as MatPlotLib as they are visual is always good as well. Can
> demo some (probably useless) 3D charts or XKCD mode if you want.

If I could demo say an NN, that’d be crazy interesting, but sadly IDK
nothing about the practicalities of AI in general.  It comes up a lot
and people know nothing about it.  If you have some pointers for a good
tutorial tho, I’d try my hand at it.

I haven’t used notebooks before, and I’m not really a fan: they look
heavy-weight and not much better than Org Mode codeblocks to me.  But I
can’t risk introducing these people to Emacs, they look at it in weid
ways when they see it on my laptop already :)

My plan is, mostly focus on graphs.  We’ll have just learned some
advanced-ish statistics stuff by the time I’ll present, so that’d
probably be very interesting to everybody.

> RE Conda and distros - I'd forget about them, in my experience you may as
> well learn to use pip and install what you need that way, in the long term
> it is faster and more flexible. Python generally supplies a perfectly good
> installer for most operating systems at python.org - no need for anything
> else. Keeping it to just standard python (+ some libs you don't explicitly
> need to explain) makes it less complex. Also - as biased as it sounds
> coming from a Python developer - I'm not sure I'd want to discuss
> alternatives (R, SPSS etc.) as it just provides more confusing choices.

This was the confirmation I was looking for :) Then I’ll just install
SciPy packages on a plain Python and call it done.  Is there a way I
distribute an installer / a portable zipball that comes with these
packages?  Or do you think a non-programmer could follow the
instructions to install?  I have friends with Macs and PCs that I think
I can use for testing procedures.

W.r.t. alternatives, I’ve already heard the statistician that helps us
with learning stats mention it, so my idea was that I could introduce
some alts and explain why Python is a good choice.  But if that’s going
to be confusing, I can skip that.

> In summary I'd aim to inspire not to teach - so show some basics at the
> beginning to show how accessible it can be, and then feel free to jump off
> into advanced python land to showcase what is possible using whatever you
> are most comfortable with. Essentially show them they can learn python, and
> then inspire them to want to learn python.

That’s kinda my goal: inspire, excite, and give good links so that they
can get on with learning quickly.

BTW, FWIW, I’ll make the material and code for these lectures available
on GitHub once I’ll have them prepared.  If anybody will be interested,
I may even try to make a video version and put it up somewhere.

> Feel free to ignore all of these thoughts, they are highly subjective.

Thanks a lot for your thoughts!  I really appreciate your help.

Cheers,

-gk.

-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Chris Angelico
On Thu, Nov 21, 2019 at 7:44 AM Göktuğ Kayaalp  wrote:
>
>
> Andrew Z   wrote:
> > Goktug,
> >   Im not clear what is the objective of the lecture? I understand it is an
> > intro, but what are you trying to achieve?
>
> Basically I need to introduce my non-programmer friends to Python and
> show them that they can easily learn to do their statistics with it,
> produce nice graphs, etc.  And I need to give them nice pointers so that
> they can self-teach w/o much friction.
>

Oh, okay. Producing graphs can't really be done with just the standard
library, so I withdraw my earlier recommendation to minimize
dependencies. It means you're going to need to spend a bit of your
time making sure they can pip-install things, but on the upside,
you're going to have way more "wow" factor from a few simple lines of
pyplot code that pop up a pretty little graph.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Abdur-Rahmaan Janhangeer
I have a draft of a concise py book for data people which i am preparing,
might be useful to you.

https://drive.google.com/file/d/1IKLBuJJWQKvcTWu-REsgm-JUGSvytBUu/view?usp=drivesdk

Abdur-Rahmaan Janhangeer
http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ
Mauritius

On Wed, 20 Nov 2019, 20:54 Göktuğ Kayaalp,  wrote:

> Hi all,
>
> I am responsible of giving my colleagues in from linguistics MA
> programme an intro to Python, and programming, with a focus on
> statistics.  It’ll be a single lecture, and I probably won’t be able to
> do more than give some demos and then some pointers to actually properly
> learn how to use the tools.
>
> The problem is I’m a rather techie power user and my audience the exact
> opposite, so I feel like I could make use of some guidance as to how to
> bridge the gap and be useful.
>
> I want to stick to Python 3, demo them a few basics of programming, then
> how to use matplotlib, Jupyter notebooks (is this what IPyNBs became?),
> and some descriptive statistics.  All this needs to happen within the
> span of a single lecture (tho if people are interested I’ll offer to do
> a few more in our own time), so 45min~1h.
>
> The first problem is installation: apart from me, a Debian user,
> everybody has Windows or Mac laptops, and IDK how you install Python on
> them.  I feel like choosing one of the distros is a good idea: I could
> just put the installers on a USB and hand it out, or just send them a
> message with simple steps to follow and set themselves up beforehand.
> Thing is, IDK nothing about distros.  Anaconda seems to be the best
> options, but comes with complications like an IDE, as opposed to just
> working with notebooks, and is huge.  Also, seems to include R stuff.
> Spyder looks nice, but I don’t want to freak people out with such an
> unfamiliar environment as an IDE just within the first few moments they
> encounter programming.  These are all humanities people.  Another
> problem is that Anaconda has ‘conda’, a non-standard package manager,
> and I’m kinda vary of introducing that to people: should I talk of pip,
> should I leave it out?  I feel like I should just stick to pip and leave
> conda out, but IDK.  Python(x,y) is interesting, but it’s apparently
> Py2k only, and that’s a no-no.
>
> So, am I better off telling people to install Anaconda, or plain Py3k +
> a selection of packages (which maybe I make into a .zip or something)?
>
> Then, I need good pointers to hand out: links to good introductions to
> Python, programming, and statistical use of Python.  Thing is, I’ve
> always learned the hacker way, i.e. skip the docs, tinker with stuff.
> Thus, IDK of any good resources out of experience, and I want to ask you
> all for some recommendations.  I prefer free and tutorial-like stuff,
> but I’ll teach them how to use the stdlib reference too.
>
> What are some good self-teaching material for those who are new to
> programming and Python, and need to mainly do statistics with
> experimental data?
>
> Finally, I’m looking for recommendations on what to show and how.  My
> current master plan is
>
> - what’s the use of programming for a linguist
> - an abstract idea of what programming is
> - basic intro to Python syntax
> - demo how to load and clean up some data
> - demo matplotlib
> - demo jupyter notebooks
> - compare with alternatives: R, SPSS, other?
> - briefly refer to libraries for
>   - NLP
>   - AI?
> - lots of links on
>   - how to learn enough coding for number crunching and plotmaking
>   - how to make use of stdlib reference
>   - how to find and utilise packages and their docs
>   - ...?
>
> I plan to produce a handout with all this info neatly organised, and
> just go with a (few) Jupyter notebooks for the rest (resisting hard the
> urge to go in with Emacs Org Mode instead :)).
>
> I’m looking forward to any recommendations from youse.  The deadline is
> about a month and a half away, and I really want to give people
> something operationable.  People are stuck with BS like SPSS, too simple
> and too pricy, when a few lines of Python (or R) is all they need.  I
> came here because IDK teaching about this stuff, and I haven’t left the
> comfort zones of a programmer ever before, so this is some new
> experience for me and I don’t want to botch it.
>
> Thanks a lot in advance,
>
>Göktuğ.
>
> --
> İ. Göktuğ Kayaalp   
>  024C 30DD 597D 142B 49AC
>  40EB 465C D949 B101 2427
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38848] compileall fails when the platform lacks a functional sem_open()

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
keywords: +patch
pull_requests: +16792
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17300

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp

Andrew Z   wrote:
> Goktug,
>   Im not clear what is the objective of the lecture? I understand it is an
> intro, but what are you trying to achieve?

Basically I need to introduce my non-programmer friends to Python and
show them that they can easily learn to do their statistics with it,
produce nice graphs, etc.  And I need to give them nice pointers so that
they can self-teach w/o much friction.

> I didnt read all the details, but maybe you can look into creating a
> docker/virtual box image with everything preinstalled.
> Good luck.

That’d definitely be my cup of tea, but sadly also too involved /
technical for my audience of absolute non-techies.

Cheers,

-gk.

-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Akkana Peck
Chris Angelico writes:
> On Thu, Nov 21, 2019 at 4:42 AM Nick Sarbicki  
> wrote:
> > RE Conda and distros - I'd forget about them, in my experience you may as
> > well learn to use pip and install what you need that way, in the long term
> 
> Agreed. 

More agreement. Someone at the local makerspace recently tried to
teach a beginning Python class; the first hour and a half lecture
was entirely devoted to trying to get Anaconda installed on
everyone's machines, and most of the people still didn't have it
installed by the end. I heard a lot of the people from the first
lecture gave up and didn't come back for the second lecture because
they still didn't have a working environment. Of the people who did
return, I saw some of them (fairly technical users to begin with, just
not in Python) later struggling with conda updates that went wrong.

Installing Python on Windows isn't trivial, but if you lead them
through each of the steps (hint: be sure not to miss the small
checkbox about adding Python to the path -- you have to scroll down
to the bottom of the options list to see it, and it's not checked by
default) it shouldn't be too bad. Also, have a copy of the installer
available on a USB stick or three unless the lecture hall is
guaranteed to have flawless wi-fi.

Can you get a couple of Windows and Mac using friends (who don't
already have Python) to help you try out the installers before the class?
Or, for Windows, you could try one of these virtualbox images:
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

> In fact, given the tight context here, I would go even further
> and stick to JUST the standard library - there's already way more in
> there than you need for a single lecture. Maybe just name-drop pip and

For a general Python class I'd agree, but since these are linguists,
it will help to have a linguistics package or two to show how Python
can help them in their work.

That means that if you don't use conda, you should probably have
them create a virtualenv so they can run pip safely.

> > In summary I'd aim to inspire not to teach - so show some basics at the
> > beginning to show how accessible it can be, and then feel free to jump off
> > into advanced python land to showcase what is possible using whatever you
> > are most comfortable with. Essentially show them they can learn python, and
> > then inspire them to want to learn python.
> 
> Absolutely agreed. Your job is not to turn them into programmers. Your
> job is just to inspire them - to show them possibilities, to excite
> them, to empower them to play.

More agreement.

But that's why it's important to have linguistics packages. If you
can give them a simple program that actually does something useful
and relevant to their jobs, that will be a lot more inspiring than
implementing Hello World or Fibonacci numbers or even web scraping.

...Akkana
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

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



[issue38853] set.repr breaches docstring contract

2019-11-20 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> My confusion stems from the fact that I expected the unpacking of a 
> set to return the same output as that obtained from the unpacking of a 
> list.

Why did you expect that?

Sets aren't lists. Lists are ordered, so they hold their items in a 
specific order. Sets are unordered, so there is no guarantee what order 
you will see when you unpack them.

If you create the list [foo, bar, baz] then the output will always be 
[foo, bar, baz] on every platform. That's a guarantee.

Sets are unordered, as documented, so there are no guarantee about what 
order you will see: it might be {foo, baz, bar} or {bar, baz, foo} or 
{foo, bar, baz} or {baz, foo, bar}, any permutation is equally valid, 
regardless of what order you created the set.

> 1. repr is apparently platform-dependent

Quite likely. Since there's no guarantee what order you will see, 
there's no guarantee that the order won't change from platform to 
platform, or version to version.

> 2. Testing reviewer's assertion: "The specific order you see will 
> depend on the specific values in the set, as well as the order that 
> they were inserted, deleted, and/or re-inserted in some arbitrary 
> way."
> This counter example, where element 0 is moved to the second position, 
> shows that there is not such order dependence:

Your example shows that the output order changes when you change the 
input order, in an unpredicatable, arbitrary way, just like I said. 
That's not a counter-example.

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread David Cuthbert


David Cuthbert  added the comment:

Jukka -- Fair enough; will reword this a bit. I'm trying to keep the 
DeprecationWarning short enough so people's eyes don't glaze over; will see 
what wordsmithing I can do here. (Once you get beyond a certain length, the 
number of folks who actually read the message goes down the longer it is.)

--

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset b762375ba28893be73f166576aecde44ad2f4001 by Miss Islington (bot) 
in branch '3.8':
bpo-38841: Skip asyncio test_create_datagram_endpoint_existing_sock_unix 
(GH-17294)
https://github.com/python/cpython/commit/b762375ba28893be73f166576aecde44ad2f4001


--

___
Python tracker 

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



[issue38868] Shutil cannot delete a folder that contains an .ini file

2019-11-20 Thread Svetlana Vodianova


Svetlana Vodianova  added the comment:

I posted my problem on Stack Overflow, but as of right now haven't received any 
answers. 

Link: 
https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file

To summarize my problem: If you use copytree to copy a source folder that 
contains a desktop.ini file to a destination, and then call rmtree() to remove 
the destination folder (for example after zipping, you may want to remove the 
uncompressed destination folder), it will throw an error indicating it doesn't 
have permission to remove the folder. Using ignore_patterns() doesn't help 
either, or to quote my problem on SO:

It seems once the source contains a .ini file, even if it isn't copied to the 
destination, rmtree() will have a problem removing the destination folder.

Powershell has almost the same issue, however, unlike Python, if you tell PS to 
ignore the .ini file, it will remove the folder without crashing.

rmtree has no problem removing folders containing 0 ini files.

--

___
Python tracker 

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



[issue38848] compileall fails when the platform lacks a functional sem_open()

2019-11-20 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

Changing the title to "compileall fails when the platform lacks a functional  
sem_open()" as the problem lies in the compileall module itself.
Nosying Antoine as the author of issue #36786.


compileall fails on android API 24:

generic_x86_64:/data/local/tmp/python $ python -m compileall --workers=2 .
Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/synchronize.py", 
line 28, in 
from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' 
(/data/local/tmp/python/lib/python3.9/lib-dynload/_multiprocessing.cpython-39d.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.9/runpy.py", line 192, in 
_run_module_as_main
return _run_code(code, main_globals, None,
  File "/data/local/tmp/python/lib/python3.9/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 425, in 

exit_status = int(not main())
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 403, in main
if not compile_dir(dest, maxlevels, args.ddir,
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 91, in 
compile_dir
with ProcessPoolExecutor(max_workers=workers) as executor:
  File "/data/local/tmp/python/lib/python3.9/concurrent/futures/process.py", 
line 555, in __init__
self._call_queue = _SafeQueue(
  File "/data/local/tmp/python/lib/python3.9/concurrent/futures/process.py", 
line 165, in __init__
super().__init__(max_size, ctx=ctx)
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/queues.py", line 
42, in __init__
self._rlock = ctx.Lock()
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/context.py", line 
67, in Lock
from .synchronize import Lock
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/synchronize.py", 
line 30, in 
raise ImportError("This platform lacks a functioning sem_open" +
ImportError: This platform lacks a functioning sem_open implementation, 
therefore, the required synchronization primitives needed will not function, 
see issue 3770.

--
components: +Library (Lib) -Tests
nosy: +pitrou
title: test_compileall fails when the platform lacks a functional  sem_open() 
-> compileall fails when the platform lacks a functional  sem_open()

___
Python tracker 

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



[issue38868] Shutil cannot delete a folder that contains an .ini file

2019-11-20 Thread Svetlana Vodianova


New submission from Svetlana Vodianova :

I posted my problem on Stack Overflow, but as of right now haven't received any 
answers. 

Link: 
https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file

To summarize my problem: If you use copytree to copy a source folder that 
contains a desktop.ini file to a destination, and then call rmtree() to remove 
the source folder, it will throw an error indicating it doesn't have permission 
to remove the folder. Using ignore_patterns() doesn't help either, or to quote 
my problem on SO:

It seems once the source contains a .ini file, even if it isn't copied to the 
destination, rmtree() will have a problem removing the source folder.

Powershell has almost the same issue, however, unlike Python, if you tell PS to 
ignore the .ini file, it will remove the folder without crashing.

rmtree has no problem removing folders containing 0 ini files.

--
components: IO, Windows
messages: 357097
nosy: QueenSvetlana, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Shutil cannot delete a folder that contains an .ini file
type: crash
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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16791
pull_request: https://github.com/python/cpython/pull/17299

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 559bad1a70ed50cc9caa7cb303b6ac1fe6a34af3 by Miss Islington (bot) 
(xdegaye) in branch 'master':
bpo-38841: Skip asyncio test_create_datagram_endpoint_existing_sock_unix 
(GH-17294)
https://github.com/python/cpython/commit/559bad1a70ed50cc9caa7cb303b6ac1fe6a34af3


--
nosy: +miss-islington

___
Python tracker 

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



Re: Use epoll but still lose packet

2019-11-20 Thread Marko Rauhamaa
Dennis Lee Bieber :
> (though as I don't really understand the use of this function, that
> may just mean that all the events will be in the one return structure,
> and not that there is only one event).

I use epoll almost every day. You've done a good job explaining it.

>   Given that your code only has one socket/file-descriptor I have
> to ponder why a simple select() isn't usable; nor do I see anything
> that detects who is sending the packet (there is no .accept() or
> .recv_from() which would provide the remote host information).

The main driver for epoll vs select is that every call to select causes
the kernel to parse the event specification from the arguments, which
can be slow if there are a lot of file descriptors to monitor. With
epoll, the event specification is loaded to the kernel only once.

To get a full benefit from epoll, you call it with the EPOLLET flag. One
nasty problem with epoll's predecessors (select and poll) is that when
output buffers are full, you have to turn on output monitoring
separately, and when the output buffers have room again, you need to
turn output monitoring off. That can create annoying code and silly
traffic between the process and the kernel.

The EPOLLET flag only gives you a notification when the situation
changes. Thus, you would monitor for EPOLLIN|EPOLLOUT|EPOLLET and forget
the file descriptor. epoll_wait will return whenever the input or output
status changes. Really economical. You must be careful, though, if you
forget to react to an event, you won't get another notification before
the status changes again.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38843] Document argparse behaviour when custom namespace object already has the field set

2019-11-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +16790
pull_request: https://github.com/python/cpython/pull/17298

___
Python tracker 

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



[issue38546] test_concurrent_futures: reap_children() warnings on RHEL7 and RHEL8 buildbots

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

AMD64 Debian PGO 3.x:
https://buildbot.python.org/all/#/builders/47/builds/3851

test_submit_keyword 
(test.test_concurrent_futures.ProcessPoolSpawnProcessPoolExecutorTest) ... 
0.62s Warning -- reap_children() reaped child process 32627
Warning -- multiprocessing.process._dangling was modified by 
test_concurrent_futures

--

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Chris Angelico
On Thu, Nov 21, 2019 at 4:42 AM Nick Sarbicki  wrote:
> RE Conda and distros - I'd forget about them, in my experience you may as
> well learn to use pip and install what you need that way, in the long term
> it is faster and more flexible. Python generally supplies a perfectly good
> installer for most operating systems at python.org - no need for anything
> else. Keeping it to just standard python (+ some libs you don't explicitly
> need to explain) makes it less complex.

Agreed. In fact, given the tight context here, I would go even further
and stick to JUST the standard library - there's already way more in
there than you need for a single lecture. Maybe just name-drop pip and
hint at the fact that there's a lot more to Python than just what you
see here, but other than that, keep it really simple.

> In summary I'd aim to inspire not to teach - so show some basics at the
> beginning to show how accessible it can be, and then feel free to jump off
> into advanced python land to showcase what is possible using whatever you
> are most comfortable with. Essentially show them they can learn python, and
> then inspire them to want to learn python.
>

Absolutely agreed. Your job is not to turn them into programmers. Your
job is just to inspire them - to show them possibilities, to excite
them, to empower them to play.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:

I also filed issue38867 specifically for enabling Tkinter on Windows ARM.

--

___
Python tracker 

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



[issue38867] Enable Tkinter on Windows ARM

2019-11-20 Thread Steve Dower


New submission from Steve Dower :

(Split out from issue33125)

We currently do not have ARM/ARM64 builds of Tcl/Tk for Windows, so we cannot 
enable tkinter on this platform.

When builds of the dependencies become possible (in 8.6.10, apparently), we can 
enable it again.

--
components: Tkinter, Windows
messages: 357093
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Enable Tkinter on Windows ARM
type: enhancement
versions: Python 3.9

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Nick Sarbicki
Hi Goktug,

Firstly good luck, inspiring a crowd of people who have never learnt to
code (and probably never expected to) to want to code sounds like a
daunting task.

I think you have broadly the right idea in that you want to spend only a
little bit of time on the basic syntax before demoing what you can do with
the language. I would spend the beginning of the lecture focusing on how
readable code can be - an attempt to make it less scary to people who
haven't touched code before - and then spend the rest of the time showing
the fun things you can do with it.

I can't see trying to take students from no code to competent SciPy users
in one lecture as a possible feat. So it would be best to simply inspire
them to want to learn more themselves. In which case I'd encourage you to
have a think as to what would be the most inspiring examples? Are jupyter
notebooks on their own something that inspires? Probably not - although
they are nice for showcasing code in. Is ETL exciting? Maybe in extremely
rare cases... NLP, AI etc can be pretty fun and powerful. Graphing
libraries such as MatPlotLib as they are visual is always good as well. Can
demo some (probably useless) 3D charts or XKCD mode if you want.

RE Conda and distros - I'd forget about them, in my experience you may as
well learn to use pip and install what you need that way, in the long term
it is faster and more flexible. Python generally supplies a perfectly good
installer for most operating systems at python.org - no need for anything
else. Keeping it to just standard python (+ some libs you don't explicitly
need to explain) makes it less complex. Also - as biased as it sounds
coming from a Python developer - I'm not sure I'd want to discuss
alternatives (R, SPSS etc.) as it just provides more confusing choices.

In summary I'd aim to inspire not to teach - so show some basics at the
beginning to show how accessible it can be, and then feel free to jump off
into advanced python land to showcase what is possible using whatever you
are most comfortable with. Essentially show them they can learn python, and
then inspire them to want to learn python.

Feel free to ignore all of these thoughts, they are highly subjective.


On Wed, Nov 20, 2019 at 5:07 PM Andrew Z  wrote:

> Goktug,
>   Im not clear what is the objective of the lecture? I understand it is an
> intro, but what are you trying to achieve?
>
> I didnt read all the details, but maybe you can look into creating a
> docker/virtual box image with everything preinstalled.
> Good luck.
>
> On Wed, Nov 20, 2019, 11:54 Göktuğ Kayaalp  wrote:
>
> > Hi all,
> >
> > I am responsible of giving my colleagues in from linguistics MA
> > programme an intro to Python, and programming, with a focus on
> > statistics.  It’ll be a single lecture, and I probably won’t be able to
> > do more than give some demos and then some pointers to actually properly
> > learn how to use the tools.
> >
> > The problem is I’m a rather techie power user and my audience the exact
> > opposite, so I feel like I could make use of some guidance as to how to
> > bridge the gap and be useful.
> >
> > I want to stick to Python 3, demo them a few basics of programming, then
> > how to use matplotlib, Jupyter notebooks (is this what IPyNBs became?),
> > and some descriptive statistics.  All this needs to happen within the
> > span of a single lecture (tho if people are interested I’ll offer to do
> > a few more in our own time), so 45min~1h.
> >
> > The first problem is installation: apart from me, a Debian user,
> > everybody has Windows or Mac laptops, and IDK how you install Python on
> > them.  I feel like choosing one of the distros is a good idea: I could
> > just put the installers on a USB and hand it out, or just send them a
> > message with simple steps to follow and set themselves up beforehand.
> > Thing is, IDK nothing about distros.  Anaconda seems to be the best
> > options, but comes with complications like an IDE, as opposed to just
> > working with notebooks, and is huge.  Also, seems to include R stuff.
> > Spyder looks nice, but I don’t want to freak people out with such an
> > unfamiliar environment as an IDE just within the first few moments they
> > encounter programming.  These are all humanities people.  Another
> > problem is that Anaconda has ‘conda’, a non-standard package manager,
> > and I’m kinda vary of introducing that to people: should I talk of pip,
> > should I leave it out?  I feel like I should just stick to pip and leave
> > conda out, but IDK.  Python(x,y) is interesting, but it’s apparently
> > Py2k only, and that’s a no-no.
> >
> > So, am I better off telling people to install Anaconda, or plain Py3k +
> > a selection of packages (which maybe I make into a .zip or something)?
> >
> > Then, I need good pointers to hand out: links to good introductions to
> > Python, programming, and statistical use of Python.  Thing is, I’ve
> > always learned the hacker way, i.e. skip the docs, tinker with 

[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b93f31fcd9f10b213c614d4944baf9ca2df2016c by Victor Stinner in 
branch 'master':
bpo-38858: Fix Py_Finalize() when called from a subinterpreter (GH-17297)
https://github.com/python/cpython/commit/b93f31fcd9f10b213c614d4944baf9ca2df2016c


--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:

I've merged the change to master, but note that the release is not enabled, so 
we aren't actually releasing ARM64 builds yet (though they will be compiled 
[but not tested] in PRs - nothing should be different from other Windows builds 
though). There's no harm in giving the build scripts a bit of bake time.

I'm also not concerned about backporting to 3.8 to make it easier to build that 
version, which I've heard a little bit of demand for. But let's run the scripts 
in master for a little while first.

Deliberately leaving the stage as "commit review" rather than "backport needed" 
for now.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:


New changeset de148f263fba75cd10d2cb010fe9c495cee4ec83 by Steve Dower in branch 
'master':
bpo-33125: Add support for building and releasing Windows ARM64 packages 
(GH-16828)
https://github.com/python/cpython/commit/de148f263fba75cd10d2cb010fe9c495cee4ec83


--

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

Yes, IMHO, but this code is related to the http.server.CGIHTTPRequestHandler.
This code looks like to be executed on the http.server.CGIHTTPRequestHandler 
not the apache server.

According to docs,
This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as 
containing CGI scripts.

reference: 
https://docs.python.org/3.9/library/http.server.html?highlight=cgihttprequesthandler#http.server.CGIHTTPRequestHandler.cgi_directories

--

___
Python tracker 

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



[issue28533] Replace asyncore

2019-11-20 Thread Jackson Riley


Jackson Riley  added the comment:

Lib/test/test_pyclbr.py - subissue issue38866
A trivial one!

--
nosy: +jacksonriley

___
Python tracker 

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



[issue38866] test_pyclbr replace asyncore

2019-11-20 Thread Jackson Riley


New submission from Jackson Riley :

sub-issue of (issue28533)[https://bugs.python.org/issue28533]

--
components: Tests
files: pyclbr.patch
keywords: patch
messages: 357087
nosy: jacksonriley
priority: normal
severity: normal
status: open
title: test_pyclbr replace asyncore
Added file: https://bugs.python.org/file48726/pyclbr.patch

___
Python tracker 

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



[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-20 Thread Brett Cannon


Brett Cannon  added the comment:

It's also possible the leading underscore was used to prevent name collisions.

Unfortunately I don't know the history of _attributes, so without someone 
digging through the git history or personally knowing the reason behind it I 
don't know whether we should be exposing it.

--

___
Python tracker 

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



[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-20 Thread Brett Cannon


Brett Cannon  added the comment:

OK, then my vote is to provide getter and setter methods that are 
underscore-prefixed to mark them as "internal" with clear comments specifying 
that they are part of PEP 523 and thus should not be needlessly broken in a 
bugfix release.

--

___
Python tracker 

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



Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Andrew Z
Goktug,
  Im not clear what is the objective of the lecture? I understand it is an
intro, but what are you trying to achieve?

I didnt read all the details, but maybe you can look into creating a
docker/virtual box image with everything preinstalled.
Good luck.

On Wed, Nov 20, 2019, 11:54 Göktuğ Kayaalp  wrote:

> Hi all,
>
> I am responsible of giving my colleagues in from linguistics MA
> programme an intro to Python, and programming, with a focus on
> statistics.  It’ll be a single lecture, and I probably won’t be able to
> do more than give some demos and then some pointers to actually properly
> learn how to use the tools.
>
> The problem is I’m a rather techie power user and my audience the exact
> opposite, so I feel like I could make use of some guidance as to how to
> bridge the gap and be useful.
>
> I want to stick to Python 3, demo them a few basics of programming, then
> how to use matplotlib, Jupyter notebooks (is this what IPyNBs became?),
> and some descriptive statistics.  All this needs to happen within the
> span of a single lecture (tho if people are interested I’ll offer to do
> a few more in our own time), so 45min~1h.
>
> The first problem is installation: apart from me, a Debian user,
> everybody has Windows or Mac laptops, and IDK how you install Python on
> them.  I feel like choosing one of the distros is a good idea: I could
> just put the installers on a USB and hand it out, or just send them a
> message with simple steps to follow and set themselves up beforehand.
> Thing is, IDK nothing about distros.  Anaconda seems to be the best
> options, but comes with complications like an IDE, as opposed to just
> working with notebooks, and is huge.  Also, seems to include R stuff.
> Spyder looks nice, but I don’t want to freak people out with such an
> unfamiliar environment as an IDE just within the first few moments they
> encounter programming.  These are all humanities people.  Another
> problem is that Anaconda has ‘conda’, a non-standard package manager,
> and I’m kinda vary of introducing that to people: should I talk of pip,
> should I leave it out?  I feel like I should just stick to pip and leave
> conda out, but IDK.  Python(x,y) is interesting, but it’s apparently
> Py2k only, and that’s a no-no.
>
> So, am I better off telling people to install Anaconda, or plain Py3k +
> a selection of packages (which maybe I make into a .zip or something)?
>
> Then, I need good pointers to hand out: links to good introductions to
> Python, programming, and statistical use of Python.  Thing is, I’ve
> always learned the hacker way, i.e. skip the docs, tinker with stuff.
> Thus, IDK of any good resources out of experience, and I want to ask you
> all for some recommendations.  I prefer free and tutorial-like stuff,
> but I’ll teach them how to use the stdlib reference too.
>
> What are some good self-teaching material for those who are new to
> programming and Python, and need to mainly do statistics with
> experimental data?
>
> Finally, I’m looking for recommendations on what to show and how.  My
> current master plan is
>
> - what’s the use of programming for a linguist
> - an abstract idea of what programming is
> - basic intro to Python syntax
> - demo how to load and clean up some data
> - demo matplotlib
> - demo jupyter notebooks
> - compare with alternatives: R, SPSS, other?
> - briefly refer to libraries for
>   - NLP
>   - AI?
> - lots of links on
>   - how to learn enough coding for number crunching and plotmaking
>   - how to make use of stdlib reference
>   - how to find and utilise packages and their docs
>   - ...?
>
> I plan to produce a handout with all this info neatly organised, and
> just go with a (few) Jupyter notebooks for the rest (resisting hard the
> urge to go in with Emacs Org Mode instead :)).
>
> I’m looking forward to any recommendations from youse.  The deadline is
> about a month and a half away, and I really want to give people
> something operationable.  People are stuck with BS like SPSS, too simple
> and too pricy, when a few lines of Python (or R) is all they need.  I
> came here because IDK teaching about this stuff, and I haven’t left the
> comfort zones of a programmer ever before, so this is some new
> experience for me and I don’t want to botch it.
>
> Thanks a lot in advance,
>
>Göktuğ.
>
> --
> İ. Göktuğ Kayaalp   
>  024C 30DD 597D 142B 49AC
>  40EB 465C D949 B101 2427
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16789
pull_request: https://github.com/python/cpython/pull/17297

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Siwon Kang  added the comment:

Thank you for your message and the info about 21323. I agree with the idea that 
cgi files are conventionally placed at the cgi-bin of the root but there is no 
explicit regulation so other servers, apache for example, handle this kind of 
sub directories successfully. In short, there is no violation in the form of 
/subdir/cgi-bin so this is nice to have if the http.server processes this case 
correctly. By the way, I didn't consider the case of continuous slashes so PR 
must be modified.

--

___
Python tracker 

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



Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Göktuğ Kayaalp
Hi all,

I am responsible of giving my colleagues in from linguistics MA
programme an intro to Python, and programming, with a focus on
statistics.  It’ll be a single lecture, and I probably won’t be able to
do more than give some demos and then some pointers to actually properly
learn how to use the tools.

The problem is I’m a rather techie power user and my audience the exact
opposite, so I feel like I could make use of some guidance as to how to
bridge the gap and be useful.

I want to stick to Python 3, demo them a few basics of programming, then
how to use matplotlib, Jupyter notebooks (is this what IPyNBs became?),
and some descriptive statistics.  All this needs to happen within the
span of a single lecture (tho if people are interested I’ll offer to do
a few more in our own time), so 45min~1h.

The first problem is installation: apart from me, a Debian user,
everybody has Windows or Mac laptops, and IDK how you install Python on
them.  I feel like choosing one of the distros is a good idea: I could
just put the installers on a USB and hand it out, or just send them a
message with simple steps to follow and set themselves up beforehand.
Thing is, IDK nothing about distros.  Anaconda seems to be the best
options, but comes with complications like an IDE, as opposed to just
working with notebooks, and is huge.  Also, seems to include R stuff.
Spyder looks nice, but I don’t want to freak people out with such an
unfamiliar environment as an IDE just within the first few moments they
encounter programming.  These are all humanities people.  Another
problem is that Anaconda has ‘conda’, a non-standard package manager,
and I’m kinda vary of introducing that to people: should I talk of pip,
should I leave it out?  I feel like I should just stick to pip and leave
conda out, but IDK.  Python(x,y) is interesting, but it’s apparently
Py2k only, and that’s a no-no.

So, am I better off telling people to install Anaconda, or plain Py3k +
a selection of packages (which maybe I make into a .zip or something)?

Then, I need good pointers to hand out: links to good introductions to
Python, programming, and statistical use of Python.  Thing is, I’ve
always learned the hacker way, i.e. skip the docs, tinker with stuff.
Thus, IDK of any good resources out of experience, and I want to ask you
all for some recommendations.  I prefer free and tutorial-like stuff,
but I’ll teach them how to use the stdlib reference too.

What are some good self-teaching material for those who are new to
programming and Python, and need to mainly do statistics with
experimental data?

Finally, I’m looking for recommendations on what to show and how.  My
current master plan is

- what’s the use of programming for a linguist
- an abstract idea of what programming is
- basic intro to Python syntax
- demo how to load and clean up some data
- demo matplotlib
- demo jupyter notebooks
- compare with alternatives: R, SPSS, other?
- briefly refer to libraries for
  - NLP
  - AI?
- lots of links on
  - how to learn enough coding for number crunching and plotmaking
  - how to make use of stdlib reference
  - how to find and utilise packages and their docs
  - ...?

I plan to produce a handout with all this info neatly organised, and
just go with a (few) Jupyter notebooks for the rest (resisting hard the
urge to go in with Emacs Org Mode instead :)).

I’m looking forward to any recommendations from youse.  The deadline is
about a month and a half away, and I really want to give people
something operationable.  People are stuck with BS like SPSS, too simple
and too pricy, when a few lines of Python (or R) is all they need.  I
came here because IDK teaching about this stuff, and I haven’t left the
comfort zones of a programmer ever before, so this is some new
experience for me and I don’t want to botch it.

Thanks a lot in advance,

   Göktuğ.

-- 
İ. Göktuğ Kayaalp   
 024C 30DD 597D 142B 49AC
 40EB 465C D949 B101 2427
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fff7bbfdb6b7c143b73b6b4b6b40e828c101110c by Victor Stinner in 
branch 'master':
bpo-38858: Add _Py_IsMainInterpreter(tstate) (GH-17293)
https://github.com/python/cpython/commit/fff7bbfdb6b7c143b73b6b4b6b40e828c101110c


--

___
Python tracker 

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



[issue38840] incorrect __all__ list in multiprocessing.managers module

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
keywords: +patch
pull_requests: +16788
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17296

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

In addition, the code is not about the path on the file system,
but about the web request path.

https://bugs.python.org/msg216960 will help you to understand.

--

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

CGI programs are stored in a directory which must be configured in the web 
server. The path is typically SERVER_ROOT/cgi-bin, so the URL looks like
http://www.domain/cgi-bin/script

So IMHO, is_cgi's assumption is correct.
IMHO, this is not the wrong code.

--
nosy: +corona10

___
Python tracker 

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



[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-20 Thread STINNER Victor


New submission from STINNER Victor :

Programs/_testembed.c contains the following test used by test_embed:

static int test_audit_subinterpreter(void)
{
Py_IgnoreEnvironmentFlag = 0;
PySys_AddAuditHook(_audit_subinterpreter_hook, NULL);
_testembed_Py_Initialize();

Py_NewInterpreter(); 
Py_NewInterpreter(); 
Py_NewInterpreter(); 
 
Py_Finalize(); 

switch (_audit_subinterpreter_interpreter_count) {
case 3: return 0;
case 0: return -1;
default: return _audit_subinterpreter_interpreter_count;
}
}

When Py_Finalize() is called, the current interpreter is a subinterpreter (the 
3rd interpreter), not the main interpreter.

* Is it correct to call Py_Finalize() in such case?
* Is Python supposed to magically destroy the 3 interpreters?

In bpo-38858, I'm trying to reuse the same code to initialize and finalize the 
"main" interpreter and subinterpreters. I had an issue with 
test_audit_subinterpreter() when working on the PR 17293.

I modified my PR 17293 to not expect that Py_Finalize() can only be called from 
the main interpreter, but actually check if the current interpreter is the main 
interpreter or not. It fix test_audit_subinterpreter() but again, I'm not sure 
what is the correct behavior?

--

Last year, we had a similar discussion about calling Py_Main() *after* 
Py_Initialize(). I hacked the code to make it possible because it was supported 
previously, even if the Py_Main() configuration is only partially applied. But 
I understood that Nick Coghlan would prefer to deprecate supporting to call 
Py_Initialize() before Py_Main().

PEP 587 added Py_RunMain() which provides a different solution to this problem:
https://docs.python.org/dev/c-api/init_config.html#c.Py_RunMain

--
components: Interpreter Core
messages: 357080
nosy: eric.snow, nanjekyejoannah, ncoghlan, vstinner
priority: normal
severity: normal
status: open
title: Can Py_Finalize() be called if the current interpreter is not the main 
interpreter?
versions: Python 3.9

___
Python tracker 

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



  1   2   >