Skip to content

bpo-29619: Convert st_ino using unsigned integer #557

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

Merged
merged 1 commit into from
Mar 9, 2017
Merged

bpo-29619: Convert st_ino using unsigned integer #557

merged 1 commit into from
Mar 9, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 8, 2017

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

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label Mar 8, 2017
@@ -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));
Copy link
Member

Choose a reason for hiding this comment

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

Use Py_BUILD_ASSERT.

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

Copy link
Member Author

Choose a reason for hiding this comment

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

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

@@ -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));
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode
(st_ino) using unsigned integers.
@vstinner vstinner merged commit 0f6d733 into python:master Mar 9, 2017
@vstinner vstinner deleted the unsigned_st_ino branch March 9, 2017 16:34
@vstinner
Copy link
Member Author

vstinner commented Mar 9, 2017

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

vstinner added a commit that referenced this pull request Mar 9, 2017
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.)
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Bumps [celery](https://github.com/celery/celery) from 5.2.6 to 5.2.7.
- [Release notes](https://github.com/celery/celery/releases)
- [Changelog](https://github.com/celery/celery/blob/master/Changelog.rst)
- [Commits](celery/celery@v5.2.6...v5.2.7)

---
updated-dependencies:
- dependency-name: celery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants