[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

bpo-29619: Convert st_ino using unsigned integer #557

Merged
merged 1 commit into from Mar 9, 2017

Projects

None yet

5 participants

Member
haypo commented Mar 8, 2017

bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.

haypo added the bugfix label Mar 8, 2017
Modules/posixmodule.c
@@ -1927,11 +1927,13 @@ _pystat_fromstructstat(STRUCT_STAT *st)
return NULL;
PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
-#ifdef HAVE_LARGEFILE_SUPPORT
+#if defined(HAVE_LARGEFILE_SUPPORT) || defined(MS_WINDOWS)
+ assert(sizeof(st->st_ino) >= sizeof(unsigned long long));
serhiy-storchaka Mar 8, 2017 Member

Use Py_BUILD_ASSERT.

Should test sizeof(st->st_ino) <= sizeof(unsigned long long).

haypo Mar 8, 2017 Member

Ooops, I wrote my assertion backwards... Fixed, thanks!

Modules/posixmodule.c
@@ -11409,7 +11411,8 @@ os_DirEntry_inode_impl(DirEntry *self)
self->win32_file_index = stat.st_ino;
self->got_file_index = 1;
}
- return PyLong_FromLongLong((long long)self->win32_file_index);
+ assert(sizeof(self->win32_file_index) >= sizeof(unsigned long long));
serhiy-storchaka Mar 8, 2017 Member

sizeof(self->win32_file_index) <= sizeof(unsigned long long)

haypo Mar 8, 2017 Member

Fixed.

haypo bpo-29619: Convert st_ino using unsigned integer
bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.
e619545
haypo merged commit 0f6d733 into python:master Mar 9, 2017

3 checks passed

codecov/patch Coverage not affected when comparing 964281a...e619545
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
haypo deleted the haypo:unsigned_st_ino branch Mar 9, 2017
haypo added a commit to haypo/cpython that referenced this pull request Mar 9, 2017
haypo + haypo bpo-29619: Convert st_ino using unsigned integer (#557)
bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.

(cherry picked from commit 0f6d733)
(Misc/NEWS conflict handled manually.)
642ff68
Member
haypo commented Mar 9, 2017

Ok, let's start with a backport to 3.6: #584

haypo added a commit that referenced this pull request Mar 9, 2017
haypo bpo-29619: Convert st_ino using unsigned integer (#557) (#584)
bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.

(cherry picked from commit 0f6d733)
(Misc/NEWS conflict handled manually.)
68d2980
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment