[issue43322] Inconsistent '#include' notation in extensions tutorial doc

2021-03-13 Thread Matthew Hughes


Change by Matthew Hughes :


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

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



[issue43322] Inconsistent '#include' notation in extensions tutorial doc

2021-02-25 Thread Matthew Hughes


New submission from Matthew Hughes :

Just a small thing in these docs, there is a mix of "#include 
", e.g. 
https://github.com/python/cpython/blame/master/Doc/extending/newtypes_tutorial.rst#L243
 and '#include "structmember.h"', mostly in the included samples e.g. 
https://github.com/python/cpython/blob/master/Doc/includes/custom2.c#L3. Should 
these all be the same?

--
assignee: docs@python
components: Documentation
messages: 387679
nosy: docs@python, mhughes
priority: normal
severity: normal
status: open
title: Inconsistent '#include' notation in extensions tutorial doc
versions: Python 3.9

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



[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes


New submission from Matthew Hughes :

While investigating Python's SSL I noticed there was no interface for 
interacting with OpenSSL's SSL_CTX_{get,set}_security_level 
(https://www.openssl.org/docs/manmaster/man3/SSL_CTX_get_security_level.html) 
so I thought I'd look into adding one (see attached patch). I'd be happy to put 
up a PR, but I have node idea if this feature would actually be desired.

--
assignee: christian.heimes
components: SSL
files: add_ssl_context_security_level.patch
keywords: patch
messages: 372839
nosy: christian.heimes, mhughes
priority: normal
severity: normal
status: open
title: Interface to OpenSSL's security level
type: enhancement
Added file: 
https://bugs.python.org/file49291/add_ssl_context_security_level.patch

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



[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes


Matthew Hughes  added the comment:

> Applications should not change this setting
> A read-only getter for the policy sounds like a good idea, though.

Thanks for the feedback, sounds reasonable to me. I'll happily work on getting 
a PR up for the read-only setter.

--

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



[issue41195] Interface to OpenSSL's security level

2020-07-02 Thread Matthew Hughes


Change by Matthew Hughes :


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

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



[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-03 Thread Matthew Hughes


Matthew Hughes  added the comment:

I noticed this test was still emitting a "ResourceWarning":
--
$ ./python -m test test_ssl -m TestPostHandshakeAuth 
0:00:00 load avg: 0.74 Run tests sequentially
0:00:00 load avg: 0.74 [1/1] test_ssl
/home/mjh/src/cpython/Lib/test/support/threading_helper.py:209: 
ResourceWarning: unclosed 
  del self.thread
ResourceWarning: Enable tracemalloc to get the object allocation traceback

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1.1 sec
Tests result: SUCCESS
--
and thought I would try silencing it by ensuring the SSL connection handled by 
the separate thread was closed before exiting. My attempt involved checking the 
thread's exception and acting accordingly, but I ran into a race condition 
which (solely as a proof of concept) I resolved by adding a sleep() call (see 
patch).

While I continue to search for a proper resolution I was wondering what 
approach someone with more insight might suggest.

--
nosy: +mhughes
Added file: https://bugs.python.org/file49294/naive_proof_of_concept.patch

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



[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-03 Thread Matthew Hughes


Matthew Hughes  added the comment:

Whoops, I realise the patch I shared contained a combination of two 
(independent) approaches I tried:

1. Add sleep and perform cleanup
2. Naively patch catch_threading_exception to accept a cleanup routine to be 
run upon exiting but before removing the thread.

--

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



[issue37322] test_ssl: test_pha_required_nocert() emits a ResourceWarning

2020-07-08 Thread Matthew Hughes


Change by Matthew Hughes :


--
pull_requests: +20541
pull_request: https://github.com/python/cpython/pull/21393

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



[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes


New submission from Matthew Hughes :

>>> import argparse
>>> parser = argparse.ArgumentParser(exit_on_error=False)
>>> parser.parse_args(["--unknown"])
usage: [-h]
: error: unrecognized arguments: --unknown

The docs https://docs.python.org/3.10/library/argparse.html#exit-on-error say:

> Normally, when you pass an invalid argument list to the parse_args() method 
> of an ArgumentParser, it will exit with error info.
> If the user would like catch errors manually, the feature can be enable by 
> setting exit_on_error to False:

This description _appears_ to be at odds with the observed behavior.

--
components: Library (Lib)
messages: 373382
nosy: mhughes
priority: normal
severity: normal
status: open
title: Argparse.parse_args exits on unrecognized option with exit_on_error=False
type: behavior
versions: Python 3.10

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



[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes


Matthew Hughes  added the comment:

> typo in the docs that it should have used enabled instead of enable

Well spotted, I'll happily fix this up.

> I guess the docs by manually mean that ArgumentError will be raised when 
> exit_on_error is False that can be handled.

To be clear, in this case, even with exit_on_error=False, ArgumentError is 
_not_ being raised, but SystemExit is.

--
versions:  -Python 3.9

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



[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2020-07-09 Thread Matthew Hughes


Matthew Hughes  added the comment:

I've attached a patch containing tests showing the current behavior, namely 
that exit_on_error does not change the behavior of 
argparse.ArgumentParser.parse_args in either case:

* An unrecognized option is given
* A required option is not given

Should the docs be updated to note this?

--
keywords: +patch
Added file: https://bugs.python.org/file49310/exit_on_error_tests.patch

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