Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Fix ordering issues in UNIX read/write pipe transport constructors #408

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

ronf
Copy link

@ronf ronf commented Aug 31, 2016

Here's a pull request designed to fix the issue reported in #368.

This commit re-orders the initialization code in the _UnixReadPipeTransport
and _UnixWritePipeTransport constructors to make sure all members are
assigned a value, even in the case where ValueError is raised due to
an incompatible type of pipe. This avoids exceptions being raised in
repr() due to the missing members.

In the case where ValueError is raised, this commit also clears the values
of _pipe, _fileno, and _protocol since this transport isn't returned,
avoiding a spurious "unclosed transport" warning when the object is
garbage-collected.

This commit re-orders the initialization code in the _UnixReadPipeTransport
and _UnixWritePipeTransport constructors to make sure all members are
assigned a value, even in the case where ValueError is raised due to
an incompatible type of pipe. This avoids exceptions being raised in
__repr__() due to the missing members.

In the case where ValueError is raised, this commit also clears the values
of _pipe, _fileno, and _protocol since this transport isn't returned,
avoiding a spurious "unclosed transport" warning when the object is
garbage-collected.
@asvetlov asvetlov merged commit 3a62f64 into python:master Aug 31, 2016
@asvetlov
Copy link

Thank you, @ronf

@ronf ronf deleted the pipe_init_fix branch August 31, 2016 13:49
@ronf
Copy link
Author

ronf commented Aug 31, 2016

Thank you!

akheron pushed a commit to akheron/cpython that referenced this pull request Sep 1, 2016
akruis pushed a commit to akruis/cpython that referenced this pull request Oct 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants