[issue17005] Add a topological sort algorithm

2020-05-31 Thread gaborbernat


gaborbernat  added the comment:

I like graphutils for what it's worth.

--

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



[issue40726] ast.Call end_lineno is defined and returns None

2020-05-22 Thread gaborbernat


New submission from gaborbernat :

Reporting an issue from https://github.com/xonsh/xonsh/issues/3581; boils down 
to, ast.Call used to not define end_lineno in 3.8:

py -3.8 -c 'import ast; type(ast.Call().end_lineno)'

 Traceback (most recent 
call last):
  File "", line 1, in 
AttributeError: 'Call' object has no attribute 'end_lineno'

However in 3.9 is defined with None:

py -3.9 -c 'import ast; type(ast.Call().end_lineno)'

This messes with some other operations in ast, namely 
https://github.com/python/cpython/blob/master/Lib/ast.py#L233

--
messages: 369567
nosy: gaborbernat
priority: normal
severity: normal
status: open
title: ast.Call end_lineno is defined and returns None
versions: Python 3.9

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



[issue40536] Addition of a "list of available time zones" function to zoneinfo

2020-05-17 Thread gaborbernat

gaborbernat  added the comment:

I think semantically the correct expression would be available timezones, free 
function, set and no cache. Document the operation is expensive and users 
should cache if they want repeated access or provide an available timezones 
cached function  my 2c

--
nosy: +gaborbernat

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



[issue40615] unstable behaviour for options in argparse

2020-05-13 Thread gaborbernat


gaborbernat  added the comment:

I did not, nm then. Thanks for the link.

--

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



[issue40615] unstable behaviour for options in argparse

2020-05-13 Thread gaborbernat


Change by gaborbernat :


--
title: argparse -> unstable behaviour for options in argparse

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



[issue40615] argparse

2020-05-13 Thread gaborbernat


New submission from gaborbernat :

Consider the following code:

from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument("--clear-magic", action="store_true")
print(parser.parse_args(["--clear"]))

parser.add_argument("--clear", action="store_true")
print(parser.parse_args(["--clear"]))

This has the following output:

Namespace(clear_magic=True)
Namespace(clear=True, clear_magic=False)

I find it surprising and confusing why the clear magic option is accepted when 
clear is not defined. I'm tempted to say it's a bug. This unstable behaviour is 
very surprising when iteratively building up the parser.  

Discovered with 
https://github.com/pypa/virtualenv/issues/1824#issuecomment-627919033

--
messages: 368776
nosy: gaborbernat
priority: normal
severity: normal
status: open
title: argparse

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



[issue25625] "chdir" Contex manager for pathlib

2020-05-02 Thread gaborbernat


gaborbernat  added the comment:

So moving way from subprocess.Process; what about having this for other use 
cases? I know there is no thread-safe way to get this working, given it's a 
process state variable. However, can we have it as a non-thread-safe feature?

--
nosy: +gaborbernat
versions: +Python 3.9 -Python 3.6

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread gaborbernat


Change by gaborbernat :


--
nosy: +gaborbernat

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



[issue40238] os.stat() on Windows succeeds for nonexistent paths with trailing spaces

2020-04-10 Thread gaborbernat


gaborbernat  added the comment:

While I agree that Windows is safe to transform paths as he wishes to, the bug 
reported here is that os.stat/os.path.isdir behaves differently than 
os.scandir. Can we make them behave the same?

--
nosy: +gaborbernat

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



[issue39675] forked process in multiprocessing does not honour atexit

2020-02-18 Thread gaborbernat


New submission from gaborbernat :

I've talked with Pablo about this in person, and as advised opening the issue 
here now. 

I've discovered that forked processes do not honour atexit registrations. See 
the following example code:

from multiprocessing import Process, set_start_method
import time
import os
import atexit


def cleanup():
print(f"cleanup {os.getpid()}")


atexit.register(cleanup)


def run():
time.sleep(0.1)
print(f"process done {os.getpid()}")
# atexit._run_exitfuncs()


if __name__ == "__main__":
set_start_method("fork")
process = Process(target=run)
process.start()
process.join()
print("app finished")

In case of a forked process childs the atexit is never executed (note it works 
if I ran them manually at the end of the child process; so they're registered 
correctly). Switching to spawn method makes it work as expected. The behaviour 
is the same even if you call register within the child process (as opposed to 
being inherited during forking). Also found this StackOverflow question that 
mentions this https://stackoverflow.com/a/26476585. At the very least the 
documentation should explain this; though I'd expect atexit to be called before 
finalization of the fork processes (assuming the child process exits with 0 
exit code). d

--
messages: 362197
nosy: davin, gaborbernat, pablogsal, pitrou
priority: normal
severity: normal
status: open
title: forked process in multiprocessing does not honour atexit

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



[issue17005] Add a topological sort algorithm

2020-01-17 Thread gaborbernat

gaborbernat  added the comment:

I think the new interface feeds better for usage in both sequential or parallel 
workflows, which means we can use a single UI for both, so  from myself

--
nosy: +gaborbernat

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-01-16 Thread gaborbernat


gaborbernat  added the comment:

Reported the issue downstream too under 
https://github.com/swagger-api/swagger-codegen/issues/9991

--

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-01-16 Thread gaborbernat


gaborbernat  added the comment:

An FYI update, the code is used by swagger-codegen to generate HTTP clients 
(https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/python/api_client.mustache#L73).
 The example below basically replicates creating such client as a global.

--

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-01-16 Thread gaborbernat


Change by gaborbernat :


--
nosy: +pablogsal

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-01-16 Thread gaborbernat


New submission from gaborbernat :

Assume the following code:

```python
from multiprocessing.pool import ThreadPool
class A(object):
def __init__(self):
self.pool = ThreadPool()
def __del__(self):
self.pool.close()
self.pool.join()
a = A()
print(a)
```

The code snippet above hangs forever on Python 3.8+ (works ok on Python 3.7 and 
earlier). An example output where I've added some extra prints on to the thread 
joins:

```
<__main__.A object at 0x1104d6070>
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
done
join thread  None
```

I've tested on MacOs, but could replicate on Linux too within the CI.

--
components: Library (Lib)
messages: 360119
nosy: gaborbernat, vstinner
priority: normal
severity: normal
status: open
title: python3.8 regression - ThreadPool join via __del__ hangs forever
versions: Python 3.8, Python 3.9

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



[issue37369] Issue with pip in venv on Powershell in Windows

2019-07-08 Thread gaborbernat


gaborbernat  added the comment:

A note on the above points, virtualenv has started migrating over to venv via 
https://github.com/pypa/virtualenv/pull/1377 . Following this, the old ways of 
virtualenv should be left to the history books. Hopefully, I can get it out 
within the next month or so.

--
nosy: +gaborbernat

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



[issue21822] KeyboardInterrupt during Thread.join hangs that Thread

2019-03-13 Thread gaborbernat


gaborbernat  added the comment:

I think I'm hitting this with subprocesses inside tox (parallel feature), any 
plans to fix this?

--
nosy: +gaborbernat

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