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
2caf8df8
Kaydet (Commit)
2caf8df8
authored
Ock 14, 2001
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug 128713: type(mmap_object) blew up on Linux.
üst
b9e202b2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
5 deletions
+16
-5
tempfile.py
Lib/tempfile.py
+9
-2
test_mmap
Lib/test/output/test_mmap
+1
-0
test_mmap.py
Lib/test/test_mmap.py
+2
-0
mmapmodule.c
Modules/mmapmodule.c
+4
-3
No files found.
Lib/tempfile.py
Dosyayı görüntüle @
2caf8df8
...
@@ -89,6 +89,7 @@ elif os.name == 'mac':
...
@@ -89,6 +89,7 @@ elif os.name == 'mac':
else
:
else
:
template
=
'tmp'
# XXX might choose a better one
template
=
'tmp'
# XXX might choose a better one
_pidcache
=
{}
def
gettempprefix
():
def
gettempprefix
():
"""Function to calculate a prefix of the filename to use.
"""Function to calculate a prefix of the filename to use.
...
@@ -96,9 +97,15 @@ def gettempprefix():
...
@@ -96,9 +97,15 @@ def gettempprefix():
notion, so that concurrent processes don't generate the same prefix.
notion, so that concurrent processes don't generate the same prefix.
"""
"""
global
template
if
template
is
None
:
if
template
is
None
:
return
'@'
+
`os.getpid()`
+
'.'
p
=
os
.
getpid
()
t
=
_pidcache
.
get
(
p
,
0
)
if
t
:
return
t
if
len
(
_pidcache
)
>
100
:
# stop unbounded growth
_pidcache
.
clear
()
t
=
_pidcache
[
p
]
=
'@'
+
`p`
+
'.'
return
t
else
:
else
:
return
template
return
template
...
...
Lib/test/output/test_mmap
Dosyayı görüntüle @
2caf8df8
test_mmap
test_mmap
<type 'mmap'>
Position of foo: 1.0 pages
Position of foo: 1.0 pages
Length of file: 2.0 pages
Length of file: 2.0 pages
Contents of byte 0: '\000'
Contents of byte 0: '\000'
...
...
Lib/test/test_mmap.py
Dosyayı görüntüle @
2caf8df8
...
@@ -18,6 +18,8 @@ def test_both():
...
@@ -18,6 +18,8 @@ def test_both():
f
.
close
()
f
.
close
()
# Simple sanity checks
# Simple sanity checks
print
type
(
m
)
# SF bug 128713: segfaulted on Linux
print
' Position of foo:'
,
string
.
find
(
m
,
'foo'
)
/
float
(
PAGESIZE
),
'pages'
print
' Position of foo:'
,
string
.
find
(
m
,
'foo'
)
/
float
(
PAGESIZE
),
'pages'
assert
string
.
find
(
m
,
'foo'
)
==
PAGESIZE
assert
string
.
find
(
m
,
'foo'
)
==
PAGESIZE
...
...
Modules/mmapmodule.c
Dosyayı görüntüle @
2caf8df8
...
@@ -841,9 +841,6 @@ new_mmap_object(PyObject *self, PyObject *args)
...
@@ -841,9 +841,6 @@ new_mmap_object(PyObject *self, PyObject *args)
int
fileno
;
int
fileno
;
HANDLE
fh
=
0
;
HANDLE
fh
=
0
;
/* Patch the object type */
mmap_object_type
.
ob_type
=
&
PyType_Type
;
if
(
!
PyArg_ParseTuple
(
args
,
if
(
!
PyArg_ParseTuple
(
args
,
"iO|z"
,
"iO|z"
,
&
fileno
,
&
fileno
,
...
@@ -956,6 +953,10 @@ DL_EXPORT(void)
...
@@ -956,6 +953,10 @@ DL_EXPORT(void)
initmmap
(
void
)
initmmap
(
void
)
{
{
PyObject
*
dict
,
*
module
;
PyObject
*
dict
,
*
module
;
/* Patch the object type */
mmap_object_type
.
ob_type
=
&
PyType_Type
;
module
=
Py_InitModule
(
"mmap"
,
mmap_functions
);
module
=
Py_InitModule
(
"mmap"
,
mmap_functions
);
dict
=
PyModule_GetDict
(
module
);
dict
=
PyModule_GetDict
(
module
);
mmap_module_error
=
PyExc_EnvironmentError
;
mmap_module_error
=
PyExc_EnvironmentError
;
...
...
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