Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select module uses uninitialized value "tv.tv_usec" #60125

Closed
tiran opened this issue Sep 11, 2012 · 2 comments
Closed

select module uses uninitialized value "tv.tv_usec" #60125

tiran opened this issue Sep 11, 2012 · 2 comments
Labels
performance Performance or resource usage

Comments

@tiran
Copy link
Member

tiran commented Sep 11, 2012

BPO 15921
Nosy @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-09-17.10:24:09.470>
created_at = <Date 2012-09-11.12:46:33.578>
labels = ['performance']
title = 'select module uses uninitialized value "tv.tv_usec"'
updated_at = <Date 2012-09-17.10:24:09.469>
user = 'https://github.com/tiran'

bugs.python.org fields:

activity = <Date 2012-09-17.10:24:09.469>
actor = 'jcea'
assignee = 'none'
closed = True
closed_date = <Date 2012-09-17.10:24:09.470>
closer = 'jcea'
components = []
creation = <Date 2012-09-11.12:46:33.578>
creator = 'christian.heimes'
dependencies = []
files = []
hgrepos = []
issue_num = 15921
keywords = ['3.3regression']
message_count = 2.0
messages = ['170299', '170321']
nosy_count = 3.0
nosy_names = ['christian.heimes', 'benj', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'resource usage'
url = 'https://bugs.python.org/issue15921'
versions = ['Python 3.3', 'Python 3.4']

@tiran
Copy link
Member Author

tiran commented Sep 11, 2012

Starting with Python 3.3 the select module access the uninitialized tv.tv_usec member of a timeval struct. I don't see the point of initializing the local variable long tv_usec from tv.tv_usec. The comment above the code states that long tv_usec is required as a workaround for Mac OS X.

http://hg.python.org/cpython/file/4754c4a710e6/Modules/selectmodule.c#l242

Coverity message:
CID 719694: Uninitialized scalar variable (UNINIT)At (5): Using uninitialized value "tv.tv_usec".
242 long tv_usec = tv.tv_usec;
243 if (_PyTime_ObjectToTimeval(tout, &tv.tv_sec, &tv_usec) == -1)
244 return NULL;
245 tv.tv_usec = tv_usec;

Suggested fix:
change line 242 to "long tv_usec;"

@tiran tiran added the performance Performance or resource usage label Sep 11, 2012
@python-dev
Copy link
Mannequin

python-dev mannequin commented Sep 11, 2012

New changeset 6cdc72f4d82c by Benjamin Peterson in branch 'default':
remove useless and defined initialization (closes bpo-15921)
http://hg.python.org/cpython/rev/6cdc72f4d82c

@python-dev python-dev mannequin closed this as completed Sep 11, 2012
@jcea jcea reopened this Sep 17, 2012
@jcea jcea closed this as completed Sep 17, 2012
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

2 participants