Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-46398: posixshmem module shm_rename freebsd support.#30621

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
devnexen wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
fromdevnexen:shm_rename

Conversation

devnexen
Copy link
Contributor

@devnexendevnexen commentedJan 16, 2022
edited by bedevere-bot
Loading

@devnexendevnexen changed the titleposixshmem module shm_rename freebsd support.bpo-46398: posixshmem module shm_rename freebsd support.Jan 16, 2022
@devnexendevnexenforce-pushed theshm_rename branch 5 times, most recently from36de652 to4bec161CompareJanuary 17, 2022 12:49
@devnexendevnexen marked this pull request as ready for reviewJanuary 17, 2022 20:10
@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelFeb 17, 2022
@MaxwellDupre

This comment was marked as outdated.


Rename a shared memory object.

Remove a shared memory object and relink to another path

Choose a reason for hiding this comment

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

Suggested change
Removeasharedmemoryobjectandrelinktoanotherpath
Removeasharedmemoryobjectandrelinktoanotherpath.

_posixshmem.shm_rename
path_from: unicode
path_to: unicode
flags: int

Choose a reason for hiding this comment

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

Suggested change
flags:int
flags:int
/

I think it was mistake to make parameters keyword-or-positional in other functions. It is better to make them positional-only, it will help if we decide to rename parameters.

erlend-aasland reacted with thumbs up emoji
With the SHM_RENAME_NOREPLACE flag, an error will be returned
if the new name exists.
"""
if platform.system() != "FreeBSD":

Choose a reason for hiding this comment

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

It is better to usehasattr(). If in futureshm_rename() be added on other platforms, it will automatically add support of SharedMemory.rename().

Comment on lines 90 to 101
const char *from = PyUnicode_AsUTF8(path_from);
const char *to = PyUnicode_AsUTF8(path_to);
if (from == NULL || to == NULL) {
return NULL;
}

Choose a reason for hiding this comment

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

This function has the same bug as shm_open() and shm_unlink() (see#115886). Please check the names for embedded null characters.

if newname:
newname = "/" + newname if self._prepend_leading_slash else newname
r = _posixshmem.shm_rename(self._name, newname, flags)
if r == None:

Choose a reason for hiding this comment

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

It is always true, isn't?

if platform.system() != "FreeBSD":
raise OSError("Unsupported operation on this platform")

if newname:

Choose a reason for hiding this comment

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

So it simply returns False if newname is empty and returns True otherwise? Why add such check in this method?

With the SHM_RENAME_NOREPLACE flag, an error will be returned
if the new name exists.
"""
if !platform.hasattr("shm_rename"):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if!platform.hasattr("shm_rename"):
ifnotplatform.hasattr("shm_rename"):

Copy link
Member

Choose a reason for hiding this comment

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

What is this platform.hasattr() function? Where does it come from?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@tirantiranAwaiting requested review from tiran

@gpsheadgpsheadAwaiting requested review from gpsheadgpshead is a code owner

@erlend-aaslanderlend-aaslandAwaiting requested review from erlend-aaslanderlend-aasland is a code owner

@corona10corona10Awaiting requested review from corona10corona10 is a code owner

Assignees
No one assigned
Labels
awaiting reviewOS-freebsdstaleStale PR or inactive for long period of time.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@devnexen@MaxwellDupre@vstinner@serhiy-storchaka@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp