[issue46800] Support for pause(2)

2022-02-19 Thread Philip Rowlands


New submission from Philip Rowlands :

Went looking for os.pause() but found nothing in the docs, bpo, or Google.
https://man7.org/linux/man-pages/man2/pause.2.html

Obviously not a popular syscall, but I have a use case for it.

--
components: Library (Lib)
messages: 413554
nosy: philiprowlands
priority: normal
severity: normal
status: open
title: Support for pause(2)
type: enhancement

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



[issue31140] Insufficient error message with incorrect formated string literal

2019-12-14 Thread Philip Rowlands


Philip Rowlands  added the comment:

Status as of 3.9.0a1:

==
test.py above appears fixed, i.e. reasonable error message.

$ ./python test.py
  File "/home/bob/pybug/Python-3.9.0a1/test.py", line 2
hello = f"{world)}"
^
SyntaxError: f-string: unmatched ')'


==
bpo-31140.py is not as bad a initially reported, but still gives the wrong line 
number.

$ ./python bpo-31140.py
  File "", line 1
(a>2s)
^
SyntaxError: invalid syntax


===
And my own example which led me to this bug. The syntax error is on line 3, not 
line 1.

$ cat fruit.py
pass
pass
s = f"{My favourite fruit is {apple}}"

$ ./python -V
Python 3.9.0a1

$ ./python fruit.py
  File "", line 1
(My favourite fruit is {apple})
^
SyntaxError: invalid syntax

--
nosy: +philiprowlands
versions: +Python 3.9

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



[issue38941] xml.etree.ElementTree.Element inconsistent warning for bool

2019-12-02 Thread Philip Rowlands


Philip Rowlands  added the comment:

I went digging through the archives, made more interesting as elementtree was 
imported into the standard library.

AFAICT, the FutureWarning for __bool__ (or __nonzero__ in py2) appeared circa 
2007-06 in version 1.3a2:
http://svn.effbot.org/public/tags/elementtree-1.3a3-20070912/CHANGES

- Added future warnings for "if e" (use explicit len(e) or is None
  test) and "e.getchildren()" (use list(e) or iteration).

The docs are still there, warning about the pitfalls and suggesting "This 
behaviour is likely to change somewhat in ElementTree 1.3."
https://effbot.org/zone/element.htm#truth-testing

12 years on, it has not, but what was the intended change (+effbot for possible 
context)??

I assumed on first reading that the plan was to switch bool(Element) to return 
True, but others have pointed out the inconsistency with len(), or having 
__bool__() raise an exception.

My 2c would be to steer devs away from using bool(Element) as a final step, 
i.e. keep the existing True/False definition, warts and all, but raise a 
SyntaxWarning (RuntimeWarning?) with a similar message to the current 
FutureWarning.

--
nosy: +effbot

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



[issue38941] xml.etree.ElementTree.Element inconsistent warning for bool

2019-11-29 Thread Philip Rowlands


Philip Rowlands  added the comment:

It's easier to justify a change in behaviour if the warning is emitted. With no 
legacy concerns, I would be happy for bool() to change, but I'm not the one who 
would receive the grumbly tickets.

How about emitting the warning in the next release, then assessing the 
behaviour change for version n+2?

--

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



[issue38941] xml.etree.ElementTree.Element inconsistent warning for bool

2019-11-29 Thread Philip Rowlands


New submission from Philip Rowlands :

Steps to reproduce:

$ python3.7
Python 3.7.2 (default, May 13 2019, 13:52:56)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as ET
>>> bool(ET.fromstring("").find(".//c"))
False


$ python3.7
Python 3.7.2 (default, May 13 2019, 13:52:56)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules['_elementtree'] = None
>>> import xml.etree.ElementTree as ET
>>> bool(ET.fromstring("").find(".//c"))
__main__:1: FutureWarning: The behavior of this method will change in future 
versions.  Use specific 'len(elem)' or 'elem is not None' test instead.


This is (almost) the smallest test case, but in real code what I was trying to 
write was:
```
# check the result code is ok
if response.find("./result[@code='ok']"):
return True
```

The unintuitive bool() behaviour was surprising, compared to other typical True 
/ False determinations on objects, and I think what the FutureWarning is trying 
to avoid.

Please implement the same warning for bool(Element) in _elementtree.c as exists 
in ElementTree.py. bpo29204 was making similar alignments between the versions, 
but didn't consider this FutureWarning.

--
components: Library (Lib)
messages: 357642
nosy: philiprowlands
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.Element inconsistent warning for bool
type: behavior

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



[issue35533] argparse standard error usage for exit / error

2018-12-19 Thread Philip Rowlands


New submission from Philip Rowlands :

Because error() mentions standard error and exit() does not, I assumed exit() 
did not use stderr, but it does.

Please mention standard error in the description of exit().

Relevant code at:
https://github.com/python/cpython/blob/3.7/Lib/argparse.py#L2482

--
assignee: docs@python
components: Documentation
messages: 332128
nosy: docs@python, philiprowlands
priority: normal
severity: normal
status: open
title: argparse standard error usage for exit / error
type: enhancement
versions: Python 3.7

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



[issue33870] pdb continue + breakpoint

2018-06-22 Thread Philip Rowlands


Philip Rowlands  added the comment:

Considering the semantics a little more, "cont 99" could be equivalent to

tbreak 99
cont

perhaps with an implicit clear on SIGINT.

This is similar in the simple case to "until 99", except "until" stops on frame 
boundaries, refuses to go backwards (e.g. in a loop), and doesn't take the full 
range of filename / lineno / function / condition.

--

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



[issue33894] tempfile.tempdir cannot be unset

2018-06-22 Thread Philip Rowlands


Philip Rowlands  added the comment:

Thanks for the edit. I did try a PR but was defeated by build/doc tool's recent 
version requirements (and didn't want to send untested changes, however minor).

The reason for getting rid of "unset" is the confusion of "state", i.e. it has 
never been assigned to, or "action", i.e. the user is unsetting it.

--

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



[issue33894] tempfile.tempdir cannot be unset

2018-06-18 Thread Philip Rowlands


Philip Rowlands  added the comment:

How about

- If tempdir is unset or None at any call to
+ If tempdir is None (the default) at any call to

This avoids headaches over the meaning of "unset", and accurately reflects the 
code at:
https://github.com/python/cpython/blob/3.6/Lib/tempfile.py#L289

--

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



[issue33894] tempfile.tempdir cannot be unset

2018-06-18 Thread Philip Rowlands


New submission from Philip Rowlands :

Quoting https://docs.python.org/3/library/tempfile.html
"""
tempfile.tempdir
When set to a value other than None, this variable defines the default value 
for the dir argument to the functions defined in this module.

If tempdir is unset or None at any call to any of the above functions except 
gettempprefix() it is initialized following the algorithm described in 
gettempdir().
"""

"If tempdir is unset ..." is not true:

$ python3 -c 'import tempfile; del tempfile.tempdir; t = tempfile.mkdtemp()'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.2/tempfile.py", line 298, in mkdtemp
dir = gettempdir()
  File "/usr/lib/python3.2/tempfile.py", line 238, in gettempdir
if tempdir is None:
NameError: global name 'tempdir' is not defined

No strong preference whether the docs change to match the implementation, or 
vice-versa.

--
messages: 319867
nosy: philiprowlands
priority: normal
severity: normal
status: open
title: tempfile.tempdir cannot be unset
type: crash

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



[issue33870] pdb continue + breakpoint

2018-06-15 Thread Philip Rowlands


New submission from Philip Rowlands :

Please extend pdb's continue to support an optional argument, identical to 
break.

When debugging I frequently want to quickly run to a certain line number then 
break. Rather than break / continue / clear (or tbreak / continue), it would be 
handy to type
(Pdb) cont 99

to run to line 99 as a one-off breakpoint.

--
messages: 319622
nosy: philiprowlands
priority: normal
severity: normal
status: open
title: pdb continue + breakpoint
type: enhancement

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