Skip to content

bpo-32318: Don't call 'globals()' in socket.accept()#4857

Closed
1st1 wants to merge 1 commit intopython:masterfrom
1st1:no_globals
Closed

bpo-32318: Don't call 'globals()' in socket.accept()#4857
1st1 wants to merge 1 commit intopython:masterfrom
1st1:no_globals

Conversation

@1st1
Copy link
Copy Markdown
Member

@1st1 1st1 commented Dec 14, 2017

@JulienPalard
Copy link
Copy Markdown
Member

LGTM

Comment thread Lib/socket.py
# accept4, so the returned socket is always blocking.
type = self.type & ~globals().get("SOCK_NONBLOCK", 0)
type = self.type
if _SOCK_NONBLOCK:
Copy link
Copy Markdown
Contributor

@asvetlov asvetlov Dec 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either _SOCK_NONBLOCK should be None if not present in socket -- then if _SOCK_NONBLOCK is not None: will be very fast check.
Or drop if: type & ~0 works pretty well

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Andrew, I don't think that the if is needed.

@asvetlov
Copy link
Copy Markdown
Contributor

Should we close the issue?
socket.type is fixed, isn't it?

@1st1
Copy link
Copy Markdown
Member Author

1st1 commented Dec 20, 2017

Yes, closing this one.

@1st1 1st1 closed this Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants