Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
aadef2b4
Unverified
Kaydet (Commit)
aadef2b4
authored
Şub 25, 2019
tarafından
Davin Potts
Kaydeden (comit)
GitHub
Şub 25, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-36102: Prepend slash to all POSIX shared memory block names (#12036)
üst
8377cd4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
shared_memory.py
Lib/multiprocessing/shared_memory.py
+10
-4
No files found.
Lib/multiprocessing/shared_memory.py
Dosyayı görüntüle @
aadef2b4
...
@@ -30,7 +30,7 @@ _SHM_SAFE_NAME_LENGTH = 14
...
@@ -30,7 +30,7 @@ _SHM_SAFE_NAME_LENGTH = 14
# Shared memory block name prefix
# Shared memory block name prefix
if
_USE_POSIX
:
if
_USE_POSIX
:
_SHM_NAME_PREFIX
=
'psm_'
_SHM_NAME_PREFIX
=
'
/
psm_'
else
:
else
:
_SHM_NAME_PREFIX
=
'wnsm_'
_SHM_NAME_PREFIX
=
'wnsm_'
...
@@ -68,6 +68,7 @@ class SharedMemory:
...
@@ -68,6 +68,7 @@ class SharedMemory:
_buf
=
None
_buf
=
None
_flags
=
os
.
O_RDWR
_flags
=
os
.
O_RDWR
_mode
=
0
o600
_mode
=
0
o600
_prepend_leading_slash
=
True
if
_USE_POSIX
else
False
def
__init__
(
self
,
name
=
None
,
create
=
False
,
size
=
0
):
def
__init__
(
self
,
name
=
None
,
create
=
False
,
size
=
0
):
if
not
size
>=
0
:
if
not
size
>=
0
:
...
@@ -95,6 +96,7 @@ class SharedMemory:
...
@@ -95,6 +96,7 @@ class SharedMemory:
self
.
_name
=
name
self
.
_name
=
name
break
break
else
:
else
:
name
=
"/"
+
name
if
self
.
_prepend_leading_slash
else
name
self
.
_fd
=
_posixshmem
.
shm_open
(
self
.
_fd
=
_posixshmem
.
shm_open
(
name
,
name
,
self
.
_flags
,
self
.
_flags
,
...
@@ -198,7 +200,11 @@ class SharedMemory:
...
@@ -198,7 +200,11 @@ class SharedMemory:
@property
@property
def
name
(
self
):
def
name
(
self
):
"Unique name that identifies the shared memory block."
"Unique name that identifies the shared memory block."
return
self
.
_name
reported_name
=
self
.
_name
if
_USE_POSIX
and
self
.
_prepend_leading_slash
:
if
self
.
_name
.
startswith
(
"/"
):
reported_name
=
self
.
_name
[
1
:]
return
reported_name
@property
@property
def
size
(
self
):
def
size
(
self
):
...
@@ -224,8 +230,8 @@ class SharedMemory:
...
@@ -224,8 +230,8 @@ class SharedMemory:
In order to ensure proper cleanup of resources, unlink should be
In order to ensure proper cleanup of resources, unlink should be
called once (and only once) across all processes which have access
called once (and only once) across all processes which have access
to the shared memory block."""
to the shared memory block."""
if
_USE_POSIX
and
self
.
name
:
if
_USE_POSIX
and
self
.
_
name
:
_posixshmem
.
shm_unlink
(
self
.
name
)
_posixshmem
.
shm_unlink
(
self
.
_
name
)
_encoding
=
"utf8"
_encoding
=
"utf8"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment