Re: [Python-Dev] PEP 543-conform TLS library

2018-11-02 Thread Brett Cannon
In case you never received a reply, you can try emailing Christian and Cory
directly for an answer.

On Fri, 26 Oct 2018 at 13:20, Mathias Laurin 
wrote:

> Hello Python Dev,
>
>
> I posted the following to python-ideas but here may be
> a more suitable place.  I apologize if cross posting
> bothers anyone.
>
>
> I have implemented an (I believe) PEP 543-conform TLS library
> and released TLS support in the latest version yesterday:
>
> https://github.com/Synss/python-mbedtls/tree/0.13.0
> https://pypi.org/project/python-mbedtls/0.13.0/
>
>
> As far as I know, I am the first one to follow PEP 543.  So one
> point is that the API works.  However, I have a couple of
> questions regarding the PEP:
>
> - I do not know what to do in `TLSWrappedBuffer.do_handshake()`.
>  The full TLS handshake requires writing to the server, reading
>  back, etc., (ClientHello, ServerHello, KeyExchange, etc.),
>  which cannot be accomplished in a single buffer.
>
>  For now, I am doing the handshake in
>  `TLSWrappedSocket.do_handshake()`: I set the BIO to using the
>  socket directly, then perform the handshake on the socket thus
>  entirely bypassing the TLSWrappedBuffer.  Once this is done, I
>  swap the BIO to using the buffer and go on encrypting and
>  decrypting from the buffer.  That is, the encrypted
>  communication is buffered.
>
> - The PEP sometimes mentions an "input buffer" and an "output
>  buffer", and some other times just "the buffer".  I believe
>  that both implementations are possible.  That is, with two
>  different buffers for input and output, or a single one.
>
>  I have implemented it with a single circular buffer (that is a
>  stream after all).  What the PEP is expecting is nonetheless
>  not clear to me.
>
>
> So, can anybody clarify these two points from the PEP?
>
>
> Or should I just address Cory Benfield (who does not seem very
> active anymore lately) and Christian Heimes directly?
>
>
> Cheers,
> Mathias
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/brett%40python.org
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Rename Include/internals/ to Include/pycore/

2018-11-02 Thread Victor Stinner
Le ven. 2 nov. 2018 à 18:32, Neil Schemenauer  a écrit :
> A simple approach would be to introduce something like
> Python-internal.h.  If you are a Python internal unit, you can
> include both Python.h and Python-internal.h.  We could, over time,
> split Python-iternal.h into smaller modular includes.

Since this discussion, I already moved most Py_BUILD_CORE in
Include/internal/. I added a lot of #include "pycore_xxx.h" in C
files.

I started to reach the limit with this PR which adds the
pycore_object.h include to not less than 33 C files:
https://github.com/python/cpython/pull/10272

I rewrote this PR to avoid the need to modify 33 C files:
https://github.com/python/cpython/pull/10276/files

I added the following code to Python.h:

#ifdef Py_BUILD_CORE
/* bpo-35081: Automatically include pycore_object.h in Python.h, to avoid
to have to add an explicit #include "pycore_object.h" to each C file. */
# include "pycore_object.h"
#endif

I'm not sure of it's a temporary workaround or not :-) Maybe a
Python-internal.h would be a better solution? We can identify the most
common header files needed to access "Python internals" and put them
in this "common" header file.

For example, most C files using Python internals have to access
_PyRuntime global variable (55 C files), so "pycore_state.h" is a good
candidate.

By the way, I don't understand the rationale to have _PyRuntime in
pycore_state.h. IMHO pycore_state.h should only contain functions to
get the Python thread and Python interpreter states. IMHO _PyRuntime
is unrelated and should belong to a different header file, maybe
pycore_runtime.h? I didn't do this change yet *because* I would have
to modify the 55 files currently including it.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Rename Include/internals/ to Include/pycore/

2018-11-02 Thread Neil Schemenauer
On 2018-10-28, Benjamin Peterson wrote:
> I don't think more or less API should be magically included based
> on whether Py_BUILD_CORE is defined or not.

I agree.

> If we want to have private headers, we should include them where
> needed and not install them. Really, Py_BUILD_CORE should go away.
> We should be moving away from monolithic includes like Python.h to
> having each C file include exactly what it uses, private or not.

It seems that is best practice (e.g. look at Linux kernel include
file style).  I wonder however what are the real benefits to having
modular include files and directly using them as needed?

Pros for modular includes:

- speeds up build process if you have good dependency info in the
  build system.  Right now, change Python.h and everything gets
  rebuilt.  I'm not sure this is a huge advantage anymore.

- makes it clearer where an API is implemented?

Cons:

- more work to include the correct headers

- build system dependency definitions are more complicated.  Other
  systems generally have automatic dependancy generates (i.e. parse
  C files and find used includes).

A simple approach would be to introduce something like
Python-internal.h.  If you are a Python internal unit, you can
include both Python.h and Python-internal.h.  We could, over time,
split Python-iternal.h into smaller modular includes.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Summary of Python tracker Issues

2018-11-02 Thread Python tracker

ACTIVITY SUMMARY (2018-10-26 - 2018-11-02)
Python tracker at https://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open6828 ( +5)
  closed 40071 (+66)
  total  46899 (+71)

Open issues with patches: 2720 


Issues opened (41)
==

#35034: Add closing and iteration to threading.Queue
https://bugs.python.org/issue35034  reopened by hemflit

#35078: Allow customization of CSS class name of a month in calendar m
https://bugs.python.org/issue35078  opened by thatiparthy

#35081: Move internal headers to Include/internal/
https://bugs.python.org/issue35081  opened by vstinner

#35082: Mock.__dir__ lists deleted attributes
https://bugs.python.org/issue35082  opened by mariocj89

#35083: Fix documentation for __instancecheck__
https://bugs.python.org/issue35083  opened by joydiamond

#35084: binascii.Error: Incorrect padding
https://bugs.python.org/issue35084  opened by Tester

#35091: Objects/listobject.c: gallop functions rely on signed integer 
https://bugs.python.org/issue35091  opened by izbyshev

#35097: IDLE add doc subsection for editor windows
https://bugs.python.org/issue35097  opened by terry.reedy

#35099: Improve the IDLE - console differences doc
https://bugs.python.org/issue35099  opened by terry.reedy

#35100: urllib.parse.unquote_to_bytes: needs "escape plus" option
https://bugs.python.org/issue35100  opened by Henry Zhu

#35101: inspect.findsource breaks on class frame objects
https://bugs.python.org/issue35101  opened by orlnub123

#35103: format_exception() doesn't work with PyErr_Fetch
https://bugs.python.org/issue35103  opened by tomasheran

#35104: IDLE: On macOS, Command-M minimizes & opens "Open Module..."
https://bugs.python.org/issue35104  opened by taleinat

#35105: Document that CPython accepts "invalid" identifiers
https://bugs.python.org/issue35105  opened by vstinner

#35107: untokenize() fails on tokenize output when a newline is missin
https://bugs.python.org/issue35107  opened by gregory.p.smith

#35108: inspect.getmembers passes exceptions from object's properties 
https://bugs.python.org/issue35108  opened by rominf

#35109: Doctest in CI uses python binary built from master causing Dep
https://bugs.python.org/issue35109  opened by xtreak

#35111: Make Custom Object Classes JSON Serializable
https://bugs.python.org/issue35111  opened by andrewchap

#35113: inspect.getsource returns incorrect source for classes when cl
https://bugs.python.org/issue35113  opened by xtreak

#35114: ssl.RAND_status docs describe it as returning True/False; actu
https://bugs.python.org/issue35114  opened by josh.r

#35118: Add peek() or first() method in queue
https://bugs.python.org/issue35118  opened by Windson Yang

#35120: SSH tunnel support to ftp lib
https://bugs.python.org/issue35120  opened by msharma

#35121: Cookie domain check returns incorrect results
https://bugs.python.org/issue35121  opened by 西田雄治

#35122: Process not exiting on unhandled exception when using multipro
https://bugs.python.org/issue35122  opened by akhi singhania

#35123: Add style guide for sentinel usage
https://bugs.python.org/issue35123  opened by madman bob

#35124: Add style guide for unit tests
https://bugs.python.org/issue35124  opened by madman bob

#35125: asyncio shield: remove inner callback on outer cancellation
https://bugs.python.org/issue35125  opened by mainro

#35126: Mistake in FAQ about converting number to string.
https://bugs.python.org/issue35126  opened by grottrumsel

#35127: pyurandom() fails if user does not have an entropy device
https://bugs.python.org/issue35127  opened by pehdrah

#35131: Cannot access to customized paths within .pth file
https://bugs.python.org/issue35131  opened by Valentin Zhao

#35132: python-gdb error: Python Exception  Type
https://bugs.python.org/issue35132  opened by Dylan Cali

#35133: Bugs in concatenating string literals on different lines
https://bugs.python.org/issue35133  opened by serhiy.storchaka

#35134: Move !Py_LIMITED_API to Include/pycapi/
https://bugs.python.org/issue35134  opened by vstinner

#35136: test_ssl fails in AMD64 FreeBSD CURRENT Shared 3.6 buildbot
https://bugs.python.org/issue35136  opened by pablogsal

#35138: timeit documentation should have example with function argumen
https://bugs.python.org/issue35138  opened by davidak

#35140: encoding problem: coding:gbk cause syntaxError
https://bugs.python.org/issue35140  opened by anmikf

#35143: Annotations future requires unparse, but not accessible from P
https://bugs.python.org/issue35143  opened by kayhayen

#35144: TemporaryDirectory can't be cleaned up if there are unsearchab
https://bugs.python.org/issue35144  opened by lilydjwg

#35145: sqlite3: "select *" should autoconvert datetime fields
https://bugs.python.org/issue35145  opened by jondo

#35147: _Py_NO_RETURN is always empty on GCC
https://bugs.python.org/issue35147  opened by izbyshev

#35148: c