[issue44675] Cross-platform issues with private methods and multiprocessing

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

More details and a suggested fix here: #37852 .

--

___
Python tracker 

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



[issue44675] Cross-platform issues with private methods and multiprocessing

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

The issue seems to be that there was a change between 3.7.7 and 3.8.6, - 
multiprocessing started using pickle dump / load which cannot handle double 
underscore methods.

See #33007 for a reproducer with pickle.

I'm using MacOS and this multiprocessing example in OP works fine in 3.7.7 and 
raises the same error as OP in 3.8.6. So from my side at least it doesn't 
appear to be a cross-platform issue (but I'm not sure why it worked on Linux on 
3.8.10 for OP).

I've also reproduced it on the latest 3.11.

So this appears to be a regression and if there's an easy fix, it's probably 
worth fixing.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue38619] [Doc] UUID.hex is lowercase

2021-11-28 Thread jiahua wang


Change by jiahua wang :


--
keywords: +patch
nosy: +wangjiahua
nosy_count: 5.0 -> 6.0
pull_requests: +28061
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29830

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon


Gideon  added the comment:

I've submitted a PR at https://github.com/python/cpython/pull/29829.

I'd just like to add that the whole Python team is amazing. Thank you for doing 
what you do!

--

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +28060
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29829

___
Python tracker 

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



[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

2021-11-28 Thread Tim Peters


Tim Peters  added the comment:

I agree with closing this - I don't know of real use cases either.

Serhiy, essentially all LSD radix sorts are stable, and rely on that for their 
own correctness. MSD radix sorts vary.

--

___
Python tracker 

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



[issue45876] Improve accuracy of stdev functions in statistics

2021-11-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +28059
pull_request: https://github.com/python/cpython/pull/29828

___
Python tracker 

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



[issue43905] dataclasses.astuple (and .asdict) do deepcopy on all fields

2021-11-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think it's find to address both of these here.

--
components: +Documentation -Library (Lib)
versions: +Python 3.10, Python 3.11, Python 3.9 -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



[issue45922] Many method, function, built-in... are not clickable and should be

2021-11-28 Thread Arthur Milchior

New submission from Arthur Milchior :

I would like to work on this documentation improvement. Before spending time on 
it, I would like to know whether it would be accepted in principle and whether 
the way I would intend to improve the documentation would be accepted.

# Problem:
In a lot of part of the documentation, the text refers to a method, function, 
built-in, variable, member defined somewhere else in the doc, but does not link 
to it (I'll call it "the defined thing" in the remaining of this BPO).

## Example

As an example, in https://docs.python.org/3.10/library/imp.html#imp.reload , 
you'll get link to import from, but no link on __name__. Admittedly, it's 
probably not a big deal by itself, and I would not have opened a bug report 
only for this one. But I'm convinced that there are sufficiently many missing 
links that a PR that would solve add a lot of them would improve the day to day 
use of the documentation in a small way for a lot of users. 

This example seems interesting to me because it also shows that creating the 
links can not be 100% automated (even if most of it can). Indeed, __name__ is a 
property of modules, but it is also a property of class, function, method, 
descriptor and generator instances. The former is defined in 
https://docs.python.org/3.10/library/types.html?highlight=__name__#types.ModuleType.__name__
 while the latter is defined in 
https://docs.python.org/3.10/library/stdtypes.html?highlight=__name__#definition.__name__
 . Hence, a commit dealing with __name__ need to check that the correct 
reference is used each time.


I got the idea from a change requested by Terry J Reedy on another of my 
documentation PR a few days ago: 
https://github.com/python/cpython/pull/29183#pullrequestreview-816414072 and I 
believe this should be more systematic.

# How I'll solve this issue

## Ensuring the PR is easy to review

For each defined thing, I'll create a commit that simply add links to this 
refered thing. In the example I gave, it will transform ``__name__`` to 
:meth:`__name__`. That means that each commit will be very easy to review (even 
if it will be boring). Even better, any diff tools can show that there are no 
other difference than the one I claim to make.

### One downside

The downside is that it requires that I do not change the place where line 
break occurs (otherwise, git default diff tool will show a lot of difference). 
this mean that some lines will grow larger than 80 characters. In this case, I 
believe that this is a cost worth paying because:
* there are already a lot of lines with more than 80 characters in the 
documentation, 
* reformating each paragraph will makes the reviewer work extremely hard, for 
virtually no benefits
* if required, a last commit can reformat all paragraphs at the end.

## How I'll find missing references

I will NOT find all missing references. I do not believe it is a realistic 
goal. My goal here is to improve the documentation, I don't care if it is not 
perfect here. What I do is that I search for lines containing matching the 
regexp `\`\.{2,}\`\`; they are generally, but not always, code that should be 
reference. For each missing reference, I'll use search and replace in the 
documentation codebase to replace the code by the link, I'll compile and check 
that the link works.

## Future work

I believe ideally a linter should warn if a single word betwen `` and `` could 
potentially be a reference. This seems harder work to be honest, I don't know 
how I'd start it. And it seems useless while so many missing references are in 
the codebase. 

# Conclusion

My questions are thus:
* If I were to make such a PR, would it be accepted
* is there any feedback, improvement one would suggest that may improve the 
result or save time

--
assignee: docs@python
components: Documentation
messages: 407242
nosy: Arthur-Milchior, docs@python
priority: normal
severity: normal
status: open
title: Many method, function, built-in... are not clickable and should be
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, 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



[issue43905] dataclasses.astuple (and .asdict) do deepcopy on all fields

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Eric: I've closed a similar issue about asdict() and now updating the title to 
keep track of both in this issue. Let me know if you want to keep them separate 
instead.

--
title: dataclasses.astuple does deepcopy on all fields -> dataclasses.astuple 
(and .asdict) do deepcopy on all fields

___
Python tracker 

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



[issue45921] codecs module doesn't support iso-8859-6-i, iso-8859-6-e, iso-8859-8-i or iso-8859-8-i

2021-11-28 Thread Mark Sapiro


New submission from Mark Sapiro :

iso-8859-6-i, iso-8859-6-e, iso-8859-8-i and iso-8859-8-i are all IANA 
recognized character sets per 
https://www.iana.org/assignments/character-sets/character-sets.xhtml. These are 
all unrecognized by codecs.lookup().

--
components: Library (Lib)
messages: 407240
nosy: msapiro
priority: normal
severity: normal
status: open
title: codecs module doesn't support iso-8859-6-i, iso-8859-6-e, iso-8859-8-i 
or iso-8859-8-i
type: behavior
versions: Python 3.10, Python 3.6, 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



[issue45614] traceback of exception with non-unicode __module__

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +28058
pull_request: https://github.com/python/cpython/pull/29827

___
Python tracker 

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



[issue45614] traceback of exception with non-unicode __module__

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +28057
pull_request: https://github.com/python/cpython/pull/29826

___
Python tracker 

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



[issue45920] make doctest fails

2021-11-28 Thread Arthur Milchior

Arthur Milchior  added the comment:

I know understand one thing I missed.
I needed to do `make venv` after changing the make file to get 3.10 in virtual 
environment.
The issue being that this would make doc harder to create on ubuntu since 3.10 
is not yet easily accessible through apt/snap.

Anyway, even when it's done, when 3.10-venv is installed on my machine and I 
remake venv, and I run doctest, it still fails with:

Document: library/statistics


Warning, treated as error:
**
File "library/statistics.rst", line 150, in default
Failed example:
fmean(grades, weights)
Exception raised:
Traceback (most recent call last):
  File "/usr/lib/python3.10/doctest.py", line 1348, in __run
exec(compile(example.source, filename, "single",
  File "", line 1, in 
fmean(grades, weights)
TypeError: fmean() takes 1 positional argument but 2 were given


Which comes from the fact that fmean got a new argument in 3.11 it didn't had 
in 3.10

So I guess the only way to actually get make doctest to work is if the virtual 
env uses the version of python in main. Is there anyway to do that?

--

___
Python tracker 

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



[issue45920] make doctest fails

2021-11-28 Thread Arthur Milchior


New submission from Arthur Milchior :

On current main,  f87ea0350286837e9e96de03f8bfa215176c2928 , 
```
cd cpython/Doc
make doctest
```
fails. 

Due to:

Document: library/functions
---

Warning, treated as error:
**
File "library/functions.rst", line ?, in default
Failed example:
list(zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True))
Expected:
Traceback (most recent call last):
  ...
ValueError: zip() argument 2 is longer than argument 1
Got:
Traceback (most recent call last):
  File "/usr/lib/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
  File "", line 1, in 
list(zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True))
TypeError: zip() takes no keyword arguments



This is not surprising since zip didn't take "Strict" kwarg in 3.8. The issue 
is that 3.10 doc is tested with Python 3.8.


If in Makefile I change Python to "Python3.10" I get a new error, but it still 
mention "/usr/lib/python3.8/doctest.py" so I guess for some reason it was not 
using 3.10 everywhere. 
I don't know make enough to have any idea how to correct this one.



By the way, is there a tool to auto-format .rst file? Initially, that was what 
I was trying to figure out, if I could get automatically warning when a new 
line is more than 80 chars long for example.

--
assignee: docs@python
components: Documentation
messages: 407238
nosy: Arthur-Milchior, docs@python
priority: normal
severity: normal
status: open
title: make doctest fails
versions: Python 3.10

___
Python tracker 

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



[issue44678] Seperate error message for discontinuous padding in binascii.a2b_base64 strict mode

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Looks like it's fixed so closing it..

--
nosy: +andrei.avk, kj
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



[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2021-11-28 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> Maybe this issue will be solved in issue44092

Yes, this will be resolved in bpo-44092. Hopefully I'll be able to land it 
sooner than later.

--

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon


Gideon  added the comment:

Sounds good. I've already made the necessary code changes on my own build, so 
I'll just finish writing the tests + documentation and submit a PR.

--

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

While I'd prefer -1 overall, I would also prefer 3 over 2. If we were adding 
the feature from scratch, we wouldn't have decimal differ from int, float, and 
complex.

And I'm not in favor of an uppercase converter, no matter what we do here. The 
other converters work like:

f'{obj!s}' -> format(str(obj))
f'{obj!r}' -> format(repr(obj))

but the proposed !u would be

f'{obj!u}' -> format(obj).upper()

That is, it operates on the result of __format__, not its input.

--

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

On the subject of accuracy, there doesn't seem to be much in it on my mac 
laptop, and it looks as though pow(2.0, x) is giving correctly rounded results 
as often as (if not more often than) exp2(x).

Here's the log of a terminal session, after recompiling Python to add exp2. It 
shows the ulps error (tested against a high-precision Decimal computation, 
which we're treating as representing the "exact" result) for both exp2(x) and 
pow(2.0, x) when the two results differ, for a selection of randomly chosen x 
in the range(-1000.0, 1000.0). Columns in the output are:

x (in hex), x (in decimal), ulps error in exp2(x), ulps error in pow(2.0, x)

>>> from decimal import getcontext, Decimal
>>> from math import exp2, pow, ulp
>>> import random
>>> getcontext().prec = 200
>>> def exp2_error_ulps(x):
... libm = exp2(x)
... exactish = 2**Decimal(x)
... return float(Decimal(libm) - exactish) / ulp(libm)
... 
>>> def pow2_error_ulps(x):
... libm = pow(2.0, x)
... exactish = 2**Decimal(x)
... return float(Decimal(libm) - exactish) / ulp(libm)
... 
>>> for n in range(1):
... x = random.uniform(-1000.0, 999.0) + random.random()
... if exp2(x) != pow(2.0, x):
... print(f"{x.hex():21} {x:22.17f} {exp2_error_ulps(x): .5f}, 
{pow2_error_ulps(x): .5f}")
... 
0x1.e28f2ad3da122p+560.31990590581177969  0.50669, -0.49331
-0x1.929e790e1d293p+9 -805.23806930946227567  0.50082, -0.49918
-0x1.49803564f5b8ap+8 -329.50081473349621319  0.49736, -0.50264
-0x1.534cf08081f4bp+8 -339.30054476902722627 -0.50180,  0.49820
-0x1.b430821fb4ad2p+8 -436.18948553238908517 -0.49883,  0.50117
0x1.2c87a8431bd8fp+8   300.52991122655743084 -0.50376,  0.49624
0x1.3e476f9a09c8cp+7   159.13952332848964488  0.50062, -0.49938
0x1.cb8b9c61e7e89p+9   919.09070991347937252  0.49743, -0.50257
0x1.ab86ed0e6c7f6p+9   855.05410938546879152  0.49742, -0.50258
0x1.97bc9af3cbf85p+9   815.47347876986952997 -0.50076,  0.49924
-0x1.b5434441ba11bp+8 -437.26276026528074681 -0.50062,  0.49938
-0x1.0ead35218910ep+9 -541.35318392937347198  0.50192, -0.49808
-0x1.dbae0b861b89cp+9 -951.35972668022759535  0.50601, -0.49399
0x1.522f005d2dcc4p+684.54589982597377684 -0.50704,  0.49296
0x1.398ff48d53ee1p+9   627.12465063665524667 -0.50102,  0.49898
-0x1.381307fbd89f5p+5  -39.00929257159069863 -0.50526,  0.49474
0x1.9dc4c85f7c53ap+9   827.53736489840161994 -0.50444,  0.49556
0x1.b357f6012d3c2p+9   870.68719496449216422 -0.50403,  0.49597
-0x1.a6446703677bbp+9 -844.53439371636284250  0.50072, -0.49928
0x1.e3dd54b28998bp+7   241.93228681497234334  0.49897, -0.50103
0x1.b4f77f18a233ep+8   436.96678308448815642  0.49593, -0.50407
-0x1.578c4ce7a7c1bp+3  -10.73587651486564276 -0.50505,  0.49495
0x1.25a9540e1ee65p+536.70767985374258302  0.49867, -0.50133
-0x1.6e220f7db7668p+8 -366.13304887511776542 -0.49904,  0.50096
-0x1.94214ed3e5264p+9 -808.26021813095985635  0.50420, -0.49580
0x1.9dcc3d281da18p+551.72472602215219695 -0.50423,  0.49577
-0x1.3ba66909e6a40p+7 -157.82502013149678532 -0.50077,  0.49923
-0x1.9eac2c52a1b47p+9 -829.34510262389892432 -0.50540,  0.49460

--

___
Python tracker 

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



[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-28 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue42268] ./configure failing when --with-memory-sanitizer specified

2021-11-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 8d1a5800645575ec876932bbb9aed3aa65d18f46 by Pablo Galindo Salgado 
in branch '3.10':
[3.10] bpo-42268: Fail the configure step if the selected compiler doesn't 
support memory sanitizer (GH-29806) (GH-29815)
https://github.com/python/cpython/commit/8d1a5800645575ec876932bbb9aed3aa65d18f46


--

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

See also previous discussion towards the end of 
https://bugs.python.org/issue3366.

FWIW, I don't think there's value in adding exp2 to the cmath module too: we'd 
have to write our own implementation, and it's just not a function that appears 
often in the complex world.

--

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

Sounds good to me, provided that all the common platforms that we care about 
have a reasonable quality implementation. This should be a straightforward 
wrapping of the C99 function, and with sufficient tests the buildbots should 
tell us if there are any issues on common platforms.

@Gideon: are you're interested in working on a pull request? I'd be happy to 
review.

(Ideally I'd like to have exp10 too, but that's not in C99 so platform support 
is likely to be spotty. If anyone's interested in pursuing that, we should make 
it a separate issue.)

> a libm exp2 is supposedly more accurate than pow(2.0, x), though I don’t 
> really see how this would be the case

pow is a difficult function to implement at high accuracy, and there are a good 
number of low quality pow implementations around in system math libraries. It's 
much easier to come up with a high accuracy implementation of a single-argument 
function - there are well known techniques for generating approximating 
polynomials that simply don't extend well to functions of two arguments.

sqrt is similar: pow(x, 0.5) is very often not correctly rounded even on 
systems where sqrt(x) _is_. (Though that one's a bit of a cheat, since common 
processors have dedicated instructions for a correctly-rounded sqrt.)

--

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I have no strong opinion. I found the discrepancy when reviewed one of Mark's 
PRs. I was surprised because I did not know that "N" is supported.

On other hand, there are reasons for supporting upper-case variant of "n" if we 
support upper-case variants of "e", "g" and "x" (formats which produce output 
containing letters).

There is an alternative solution of the problem solved by upper-case variations 
of formats: add a special converter for converting a string to upper case, so 
for example f'{x:12.8E}' could be written as f'{x:12.8e!u}'.

I prefer -1 or 2. If we choose deprecation I prefer adding an upper-case 
converter.

--

___
Python tracker 

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



[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Tim Peters


Tim Peters  added the comment:

I'll add that the rounding mode is intended to ease emulating fixed-point 
arithmetic. The decimal spec claimed that was a goal, but there really isn't 
any direct support for saying, e.g., "I want two digits after the decimal 
point". Only for specifying total precision, independent of the radix point's 
position.

So, e.g., if you want to work with tax rates, etc, but keeping results to penny 
precision,

1. Set the rounding mode to ROUND_05UP with "plenty of" precision digits.

2. To add, say, a statutory 3.578% tax rate to an item with cost C:

   C *= decimal.Decimal("1.03578")
   C = C.quantize(decimal.Decimal(".01"), decimal.ROUND_HALF_UP)

or whatever final rounding mode local statutes require.

I"m not sure anyone other than Mike Cowlishaw realizes that, though ;-)

--

___
Python tracker 

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



[issue45912] [argparse] Print texts starting with capital letters and finish with dot for more formality

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think argparse should do such formatting. You can give it the help text 
in this format if that's what you want printed, and you can implement your own 
formatter: https://docs.python.org/3/library/argparse.html#formatter-class

--
nosy: +iritkatriel

___
Python tracker 

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



[issue28140] Give better errors for OS commands, like 'pip', in REPL, script

2021-11-28 Thread Tom Viner


Tom Viner  added the comment:

I've updated my pull request from 3 years ago. Fixed merge conflicts and 
addressed all comments. 

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

--

___
Python tracker 

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



[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Christian Heimes


Christian Heimes  added the comment:

Thank you!

--

___
Python tracker 

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



[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Tim Peters


Tim Peters  added the comment:

Not a good idea in general - this rounding mode is _mostly_ "to zero", and 
isn't intended for chains of operations. I don't believe I've ever seen it used 
in a real program, so the current "no example at all" is a fair representation 
of real usage ;-)

--

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun


Eryk Sun  added the comment:

I've created bpo-45919 with a suggested enhancement to use GetFileType() in 
Windows, since the Windows C runtime does not provide fcntl().

--

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun


Change by Eryk Sun :


--
Removed message: https://bugs.python.org/msg407216

___
Python tracker 

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



[issue45919] Use WinAPI GetFileType() in is_valid_fd()

2021-11-28 Thread Eryk Sun


New submission from Eryk Sun :

During startup, is_valid_fd() in Python/pylifecycle.c is called to validate 
stdin, stdout, and stderr. Performance isn't critical here, but every bit helps 
in reducing startup time. In my tests, implementing this check in Windows via 
GetFileType((HANDLE)_get_osfhandle(fd)) is 5-6 times faster than 
close(dup(fd)). For example:

#if defined(MS_WINDOWS)
HANDLE hfile;
_Py_BEGIN_SUPPRESS_IPH
hfile = (HANDLE)_get_osfhandle(fd);
_Py_END_SUPPRESS_IPH
return (hfile != INVALID_HANDLE_VALUE &&
  GetFileType(hfile) != FILE_TYPE_UNKNOWN);
#endif

--
components: Interpreter Core, Windows
keywords: easy (C)
messages: 407221
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Use WinAPI GetFileType() in is_valid_fd()
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44695] asdict use deep copy to dataclass instances

2021-11-28 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Duplicate of https://bugs.python.org/issue43905

--
nosy: +andrei.avk
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> dataclasses.astuple does deepcopy on all fields

___
Python tracker 

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



[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I’m concerned though that the intermediate calculations might be worse off than 
with some other rounding mode.

--

___
Python tracker 

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



[issue45912] [argparse] Print texts starting with capital letters and finish with dot for more formality

2021-11-28 Thread Vishal Pandey


Vishal Pandey  added the comment:

I would like to work on it as my first contribution to the python repository. 
Can you please assign this to me?

--
nosy: +vishalpandeyvip

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset f87ea0350286837e9e96de03f8bfa215176c2928 by Christian Heimes in 
branch 'main':
bpo-45915: use fcntl(fd, F_GETFD) in is_valid_fd() (GH-29821)
https://github.com/python/cpython/commit/f87ea0350286837e9e96de03f8bfa215176c2928


--

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun


Eryk Sun  added the comment:

In Windows, GetFileType((HANDLE)_get_osfhandle(fd)) is several times faster 
than close(dup(fd)). For example:

#if defined(MS_WINDOWS)
int type;
_Py_BEGIN_SUPPRESS_IPH
type = GetFileType((HANDLE)_get_osfhandle(fd));
_Py_END_SUPPRESS_IPH
return type != FILE_TYPE_UNKNOWN;
#endif

If the C file descriptor isn't assigned and flagged FOPEN, then 
_get_osfhandle() returns (intptr_t)-1. This is the pseudohandle value for the 
current process, so GetFileType() will fail with an invalid handle error, as 
expected.

--
nosy: +eryksun

___
Python tracker 

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



[issue45912] [argparse] Print texts starting with capital letters and finish with dot for more formality

2021-11-28 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy:  -pablogsal

___
Python tracker 

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



[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Candidate example:

with localcontext() as ctx:
ctx.prec += 10# Perform a higher precision calculation
ctx.rounding = ROUND_05UP # Avoid double rounding of the final 
calculation step
s = calculate_something()
s = +s  # Round the final result back to the default precision

Thoughts:

* This would highlight the intended purpose of ROUND_05UP.
* Usually, it would slightly improve accuracy.
* OTOH, it would rarely make a difference in practice.

https://docs.python.org/3/library/decimal.html#decimal.localcontext

--
assignee: rhettinger
components: Documentation
messages: 407215
nosy: mark.dickinson, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Possibly use ROUND_05UP in decimal's localcontext() example
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +mark.dickinson, rhettinger, serhiy.storchaka, tim.peters

___
Python tracker 

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



[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Gideon

New submission from Gideon :

Dear Python Support Team,

I was looking through Python’s list of supported methods in the math module, 
and I noticed that C99’s exp2 method was not implemented. This method raises 2 
to the power of the supplied argument. I understand that it’s pretty trivial to 
so this in Python using 2**x or math.pow(x, 2), but I think there are a few 
reasons why we might want to incorporate it:

Uniformity: This method exists most other programming languages and libraries, 
including numpy.

Consistency: Every math method from C99 except exp2 is in python’s math or 
cmath module (math.cbrt will be added as of python 3.11).

Triviality: this method is a part of C99 and is also supported by Visual 
Studio, so it’s very easy to implement. 

Accuracy(?): a libm exp2 is supposedly more accurate than pow(2.0, x), though I 
don’t really see how this would be the case (See 
https://bugs.python.org/issue31980)


That said, this method is a little redundant, so I completely understand if 
this request is rejected

Non-exhaustive list of other languages / libraries that use this method:

Rust: https://docs.rs/libm/0.1.1/libm/fn.exp2.html
Javascript: https://github.com/stdlib-js/math-base-special-exp2
Numpy: https://numpy.org/doc/stable/reference/generated/numpy.exp2.html
C++: https://en.cppreference.com/w/cpp/numeric/math/exp2 (Not authoritative)
Ruby: https://www.rubydoc.info/gems/ruby-mpfi/MPFI%2FMath.exp2

Similar Issues:
https://bugs.python.org/issue44357
https://bugs.python.org/issue31980

--
components: Library (Lib)
messages: 407214
nosy: Gideon
priority: normal
severity: normal
status: open
title: Add math.exp2() function: 2^x
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue28140] Give better errors for OS commands, like 'pip', in REPL, script

2021-11-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I closed #45721, which has additional comments, as a duplicate of this.

'print foo' now results in "SyntaxError: Missing parentheses in call to 
'print'. Did you mean print(...)?"

--
components: +Interpreter Core
nosy: +aroberge
title: Attempt to give better errors for pip commands typed into the REPL -> 
Give better errors for OS commands, like 'pip', in REPL, script

___
Python tracker 

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



[issue45721] Improve error message for OS command entered at >>> prompt

2021-11-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Attempt to give better errors for pip commands typed into the 
REPL

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'd support -1.

--

___
Python tracker 

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



[issue28499] Logging module documentation needs a rework.

2021-11-28 Thread Vinay Sajip


Vinay Sajip  added the comment:

Closing, as no objections raised.

--
resolution:  -> not a bug
stage: needs patch -> 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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I support deprecating "N".

--

___
Python tracker 

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



[issue19737] Documentation of globals() and locals() should be improved

2021-11-28 Thread jiahua wang


Change by jiahua wang :


--
nosy: +180909
nosy_count: 5.0 -> 6.0
pull_requests: +28055
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29823

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 209cec8a2a2e845df5af764a9171af05a2a4c8e3 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-19460: Add test for MIMENonMultipart (GH-29817) (#29819)
https://github.com/python/cpython/commit/209cec8a2a2e845df5af764a9171af05a2a4c8e3


--

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2021-11-28 Thread jiahua wang


Change by jiahua wang :


--
nosy: +180909
nosy_count: 2.0 -> 3.0
pull_requests: +28054
pull_request: https://github.com/python/cpython/pull/29822

___
Python tracker 

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



[issue45913] readline + GTK + Pytest Seg Fault with Python 3.7 and 3.10 on CI

2021-11-28 Thread Dan Yeaw


Dan Yeaw  added the comment:

I continued to look in to this and updated the title of the issue, I don't 
think this is caused by doctest. I also updated a minimum example here:

https://github.com/danyeaw/plugin-console-test

If using pytest and GTK, any module loaded that makes use of readline causes a 
seg fault on CI. For example rlcompleter and doctest cause the crash, and even 
just importing readline.

This is reproducible for Python 3.10 and Python 3.7, but not 3.8 or 3.9.

--
title: Doctest Seg Fault with Python 3.10 on CI -> readline + GTK + Pytest Seg 
Fault with Python 3.7 and 3.10 on CI
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



[issue17383] [doc] Possibly ambiguous phrasing in tutorial/modules#more-on-modules

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: Possibly ambiguous phrasing in tutorial/modules#more-on-modules -> [doc] 
Possibly ambiguous phrasing in tutorial/modules#more-on-modules
versions: +Python 3.11 -Python 2.7, 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



[issue20281] [doc] time.strftime %z format specifier is the same as %Z

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

Seems like the only thing to do on this issue is to add a reference to the 
footnote in the table entries for %z and %Z.

--
components: +Library (Lib)
keywords: +easy
nosy: +iritkatriel
title: time.strftime %z format specifier is the same as %Z -> [doc] 
time.strftime %z format specifier is the same as %Z
type: behavior -> enhancement
versions: +Python 3.11 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue22356] mention explicitly that stdlib assumes gmtime(0) epoch is 1970

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

The docs now say 

"The epoch is the point where the time starts, and is platform dependent. For 
Unix, the epoch is January 1, 1970, 00:00:00 (UTC). To find out what the epoch 
is on a given platform, look at time.gmtime(0)."

which I believe covers this issue.

--
nosy: +iritkatriel
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> time.time() documentation should mention UTC timezone

___
Python tracker 

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



[issue22618] [doc] urllib.parse.parse_qsl different results after urllib.parse.unquote

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: urllib.parse.parse_qsl different results after urllib.parse.unquote -> 
[doc] urllib.parse.parse_qsl different results after urllib.parse.unquote
versions: +Python 3.11 -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue12970] [doc] os.walk() consider some symlinks as dirs instead of non-dirs

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: os.walk() consider some symlinks as dirs instead of non-dirs -> [doc] 
os.walk() consider some symlinks as dirs instead of non-dirs
versions: +Python 3.11 -Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue10149] [doc] Data truncation in expat parser

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

Eric's patch needs to be converted to a GitHub PR.

--
components: +Library (Lib)
keywords: +easy -patch
nosy: +iritkatriel
title: Data truncation in expat parser -> [doc] Data truncation in expat parser
versions: +Python 3.11 -Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue16726] expat ParseFile expects bytes, not string

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
components: +Library (Lib)
nosy: +iritkatriel
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue28140] Attempt to give better errors for pip commands typed into the REPL

2021-11-28 Thread Alex Waygood


Alex Waygood  added the comment:

Similar discussion in a newer issue: https://bugs.python.org/issue45721

--
nosy: +AlexWaygood, pablogsal, steven.daprano, terry.reedy

___
Python tracker 

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



[issue28140] Attempt to give better errors for pip commands typed into the REPL

2021-11-28 Thread Irit Katriel


Irit Katriel  added the comment:

On 3.11:

>>> pip install requests
  File "", line 1
pip install requests
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31184] Fix data descriptor detection in inspect.getattr_static

2021-11-28 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Contradiction in definition of "data descriptor" between 
(dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor 
how-to)

___
Python tracker 

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



[issue45916] documentation link error

2021-11-28 Thread Tony Zhou

New submission from Tony Zhou :

3.10.0 Documentation » The Python Tutorial » 15. Floating Point Arithmetic: 
Issues and Limitationsin 
in the link "The Perils of Floating Point" brings user to https://www.hmbags.tw/
I don't think this is right. please check

--
messages: 407200
nosy: cookiez6
priority: normal
severity: normal
status: open
title: documentation link error
type: security

___
Python tracker 

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



[issue45847] Port module setup to PY_STDLIB_MOD() macro and addext()

2021-11-28 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset aaf4cfd5774d23ca48ff304ace1f64426201 by Erlend Egeberg 
Aasland in branch 'main':
bpo-45847: Port _multiprocessing to PY_STDLIB_MOD (GH-29768)
https://github.com/python/cpython/commit/aaf4cfd5774d23ca48ff304ace1f64426201


--

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 2c398a5acf85d1bbc5796f3385972d0759b90e54 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-19460: Add test for MIMENonMultipart (GH-29817) (GH-29818)
https://github.com/python/cpython/commit/2c398a5acf85d1bbc5796f3385972d0759b90e54


--

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue28445] Wrong documentation for GzipFile.peek

2021-11-28 Thread jiahua wang


Change by jiahua wang :


--
keywords: +patch
nosy: +180909
nosy_count: 4.0 -> 5.0
pull_requests: +28052
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29820

___
Python tracker 

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



[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Christian Heimes


New submission from Christian Heimes :

is_valid_fd() uses dup() or fstat() to check whether an fd is valid. Both 
operations are costly. 

fcntl() with F_GETFD returns the file descriptor flags (e.g. CLOEXEC) and -1 
with errno set to EBADF when fd is not an open file descriptor. It's faster 
than duplicating + closing a fd or calling fstat(). The idea to use fcntl(fd, 
F_GETFD) is inspired by the patch [1]. According to Stackoverflow [2]:

> fcntl(fd, F_GETFD) is the canonical cheapest way to check that fd is a valid 
> open file descriptor.
> F_GETFD is cheaper in principle since it only dereferences the 
> (process-local) file descriptor in kernel space, not the underlying open file 
> description (process-shared) which it refers to.

[1] 
https://github.com/singlestore-labs/cpython/commit/0364554615c79b9364a0acf3038147a999ea2219

[2] 
https://stackoverflow.com/questions/12340695/how-to-check-if-a-given-file-descriptor-stored-in-a-variable-is-still-valid

--
components: C API
messages: 407197
nosy: christian.heimes, vstinner
priority: normal
severity: normal
status: open
title: Use fcntl(fd, F_GETFD) to check whether an fd is valid
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

I could be persuaded for any of options -1, 1 and 2. I don't much like option 0.

--

___
Python tracker 

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



[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Mark Dickinson


Mark Dickinson  added the comment:

Eric, Serhiy: do you have opinions on the right way forward?

Here are 6 options, on a spectrum of increasing level of acceptance of "N".

-2. Remove "N" support for cdecimal right now (i.e., for Python 3.11), on the 
basis that there's no need for deprecation warnings, because it was never 
officially a feature.
-1. Deprecate "N" support for cdecimal, remove it in Python 3.13.
0. Do nothing (the default), leaving _pydecimal and cdecimal inconsistent.
1. Add "N" support to the Python implementation for parity with cdecimal, but 
don't document it - leave it as an undocumented feature.
2. Officially add "N" support to decimal formatting - add documentation, tests, 
and fix the Python implementation.
3. Officially add "N" support to all numeric formatting ...

--

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +28051
pull_request: https://github.com/python/cpython/pull/29819

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +28050
pull_request: https://github.com/python/cpython/pull/29818

___
Python tracker 

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



[issue19460] Add test for MIMENonMultipart

2021-11-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 46c8d915715aa2bd4d697482aa051fe974d440e1 by 180909 in branch 
'main':
bpo-19460: Add test for MIMENonMultipart (GH-29817)
https://github.com/python/cpython/commit/46c8d915715aa2bd4d697482aa051fe974d440e1


--
nosy: +asvetlov

___
Python tracker 

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



[issue45911] SystemError occured while running an extention

2021-11-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue45911] SystemError occured while running an extention

2021-11-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

At first glance, it looks like:
if(!(PyArg_ParseTuple(args,"s",s))) return NULL;
should be:
if(!(PyArg_ParseTuple(args,"s",))) return NULL;

The docs say: "A pointer to an existing string is stored in the character 
pointer variable whose address you pass."

--
nosy: +eric.smith

___
Python tracker 

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