[issue47184] multiprocessing.set_start_method force argument is not documented

2022-04-05 Thread Sam Ezeh


Sam Ezeh  added the comment:

It's quite weird, the documentation says set_start_method "should not be used 
more than once in the program" twice.

The source code also contains the following line

```
# Type of default context -- underlying context can be set at most once
```

I'm not too familiar with the multiprocessing library but with the force 
parameter set to True, I don't understand why that can't happen. If there's a 
specific reason, maybe that should be documented too.

--

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



[issue47184] multiprocessing.set_start_method force argument is not documented

2022-04-05 Thread Sam Ezeh


Change by Sam Ezeh :


--
keywords: +patch
nosy: +sam_ezeh
nosy_count: 2.0 -> 3.0
pull_requests: +30395
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32339

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



[issue15795] Zipfile.extractall does not preserve file permissions

2022-04-04 Thread Sam Ezeh


Sam Ezeh  added the comment:

I don't know what the best course of action would be but if preserving 
permissions needs to be back-ported, could the default permission preservation 
flag in 3.11+ be the one to preserve safe permissions and then make it so that 
the previous versions (<3.11, without the constants) always take this course of 
action? Maintaining the different options for preserving permissions while 
still allowing for this functionality to be back-ported.

I don't have a strong opinion on backporting permission preservation but to me, 
it seems like it would be a change in behaviour instead of a bug fix. The 
current default in the PR is to not preserve any permissions but if necessary, 
I'll change it to whatever is agreed upon.

I'll move the constants into an enum, but right now I'm not sure how I'd name 
the class.

As an aside, while writing this comment I realised that the reason tests aren't 
passing on my end might very well be due to the fact I do CPython work on an 
NTFS partition instead of on my main EXT4 partition.

--

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



[issue30964] Mention ensurepip in package installation docs

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests:  -30352

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



[issue39064] ValueError in zipfile.ZipFile

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30353
pull_request: https://github.com/python/cpython/pull/32291

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



[issue30964] Mention ensurepip in package installation docs

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
nosy: +sam_ezeh
nosy_count: 3.0 -> 4.0
pull_requests: +30352
pull_request: https://github.com/python/cpython/pull/32291

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



[issue39064] ValueError in zipfile.ZipFile

2022-04-03 Thread Sam Ezeh


Sam Ezeh  added the comment:

Yes, of course.

--

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



[issue39064] ValueError in zipfile.ZipFile

2022-04-03 Thread Sam Ezeh


Sam Ezeh  added the comment:

One way of doing this is by making the central directory offset negative by 
first taking the zip file containing just an EOCD record and then listing the 
total size of the central directory records as positive.

```
Python 3.11.0a4+ (heads/bpo-39064:eb1935dacf, Apr  3 2022, 19:09:53) [GCC 
11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
>>> import io
>>> b = [80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> b[12] = 1
>>> f = io.BytesIO(bytes(b))
>>> zipfile.ZipFile(f)
Traceback (most recent call last):
  File "/run/media/sam/OS/Git/cpython/Lib/zipfile.py", line 1370, in 
_RealGetContents
fp.seek(self.start_dir, 0)
^^
ValueError: negative seek value -1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/run/media/sam/OS/Git/cpython/Lib/zipfile.py", line 1284, in __init__
self._RealGetContents()
^^^
  File "/run/media/sam/OS/Git/cpython/Lib/zipfile.py", line 1372, in 
_RealGetContents
raise BadZipFile("Bad offset for central directory")

zipfile.BadZipFile: Bad offset for central directory
>>> 
```

--

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



[issue39064] ValueError in zipfile.ZipFile

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
nosy: +sam_ezeh

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



[issue15795] Zipfile.extractall does not preserve file permissions

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30350
pull_request: https://github.com/python/cpython/pull/32289

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



[issue15795] Zipfile.extractall does not preserve file permissions

2022-04-03 Thread Sam Ezeh


Change by Sam Ezeh :


--
nosy: +sam_ezeh

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



[issue47200] Add ZipInfo.mode property

2022-04-02 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30323
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32252

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



[issue47200] Add ZipInfo.mode property

2022-04-02 Thread Sam Ezeh


New submission from Sam Ezeh :

Initially, I was looking at bpo-18262 and saw the following Stack Overflow 
thread that was linked.

https://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838

I've attached a patch that gives ZipInfo objects a `ZipInfo.mode` property 
getter and setter to get and set the file mode.

I considered adding ZipFile.chmod but I didn't know how it would work given 
that archives can contain duplicate files.

As an aside, I wondered if there's a way to update file attributes inside zip 
archives without deleting and rewriting them and if not, whether it would be 
worthwhile to add one.

--
components: Library (Lib)
files: sam_ezeh.patch
keywords: patch
messages: 416550
nosy: sam_ezeh
priority: normal
severity: normal
status: open
title: Add ZipInfo.mode property
type: enhancement
versions: Python 3.11
Added file: https://bugs.python.org/file50715/sam_ezeh.patch

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30313
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32242

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

This is what functionality looks like when supplying incorrect attribute names 
with the patch.

Python 3.11.0a6+ (heads/bpo-47135-dirty:d4bb38f82b, Apr  1 2022, 20:01:56) [GCC 
11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _pydecimal
>>> ctx = _pydecimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
  File "", line 1, in 
  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in 
__setattr__
raise AttributeError(
^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with _pydecimal.localcontext(precision=10) as ctx:
... pass
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 506, in 
localcontext
setattr(ctx, key, value)

  File "/run/media/sam/OS/Git/cpython/Lib/_pydecimal.py", line 3974, in 
__setattr__
raise AttributeError(
^
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> import decimal
>>> ctx = decimal.getcontext()
>>> ctx.precision = 10
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'decimal.Context' object has no attribute 'precision'
>>> with decimal.localcontext(precision=10) as ctx:
... pass
... 
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'precision' is an invalid keyword argument for this function
>>>

--

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've uploaded a patch and it seems to work, which I'm very proud of.

I'll create some tests, amend documentation and create a news entry. After 
that, I'll create a pull request on GitHub.

--
keywords: +patch
Added file: https://bugs.python.org/file50713/sam_ezeh.patch

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I'm looking into adding this

> Seems reasonable to me, but I think a full implementation would want to throw 
> an error for keyword args that don't already exist as context attributes 
> (otherwise typos would fail silently)

For _pydecimal, I think this would automatically happen automatically as 
Context.__setattr__ raises AttributeError when it's passed a name that isn't a 
context attribute.

For _decimal this can be done with keyword arguments and 
`PyArg_ParseTupleAndKeywords`.

--
nosy: +sam_ezeh

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


--
pull_requests: +30300
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/32225

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Added file: https://bugs.python.org/file50711/sam_ezeh.patch

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Removed file: https://bugs.python.org/file50710/sam_ezeh.patch

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Added file: https://bugs.python.org/file50710/sam_ezeh.patch

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Change by Sam Ezeh :


Removed file: https://bugs.python.org/file50709/sam_ezeh.patch

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



[issue32547] csv.DictWriter emits strange errors if fieldnames is an iterator

2022-04-01 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've submitted a patch that introduces code that raises TypeError at 
construction if `fieldnames` is not a sequence

--
keywords: +patch
nosy: +sam_ezeh
Added file: https://bugs.python.org/file50709/sam_ezeh.patch

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



[issue4833] Explicit directories for zipfiles

2022-03-28 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've submitted the above patch. I created the ZipFile.mkdir function, created 
the necessary tests and wrote the documentation.

I think it is ready for review.

--
Added file: https://bugs.python.org/file50705/sam_ezeh.patch

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



[issue4833] Explicit directories for zipfiles

2022-03-28 Thread Sam Ezeh


Change by Sam Ezeh :


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

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



[issue4833] Explicit directories for zipfiles

2022-03-27 Thread Sam Ezeh


Sam Ezeh  added the comment:

I'm looking into adding ZipFile.mkdir

--

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



[issue4833] Explicit directories for zipfiles

2022-03-27 Thread Sam Ezeh


Change by Sam Ezeh :


--
nosy: +sam_ezeh

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



[issue14265] Fully qualified test name in failure output

2022-03-27 Thread Sam Ezeh


Sam Ezeh  added the comment:

The provided patch wasn't entirely compatible with the current upstream code. I 
used the patch file to apply the changes to `Lib/unittest/case.py`, resolved 
the remaining conflicts with the patches to the test files and amended existing 
tests for the library.

I updated the documentation for unittest to reflect the changes in behaviour.

--

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



[issue14265] Fully qualified test name in failure output

2022-03-27 Thread Sam Ezeh


Change by Sam Ezeh :


--
keywords: +patch
pull_requests: +30218
pull_request: https://github.com/python/cpython/pull/32138

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



[issue14265] Fully qualified test name in failure output

2022-03-27 Thread Sam Ezeh


Change by Sam Ezeh :


--
nosy: +dignissimus

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