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
16e6a809
Kaydet (Commit)
16e6a809
authored
Ara 12, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
PyUnicode_Resize(): warn about canonical representation
Call also directly unicode_resize() in unicodeobject.c
üst
b0a82a6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
unicodeobject.h
Include/unicodeobject.h
+4
-1
unicodeobject.c
Objects/unicodeobject.c
+13
-12
No files found.
Include/unicodeobject.h
Dosyayı görüntüle @
16e6a809
...
@@ -779,7 +779,10 @@ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
...
@@ -779,7 +779,10 @@ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
a new string and copy characters), or create a new string.
a new string and copy characters), or create a new string.
Error handling is implemented as follows: an exception is set, -1
Error handling is implemented as follows: an exception is set, -1
is returned and *unicode left untouched. */
is returned and *unicode left untouched.
WARNING: The function doesn't check string content, the result may not be a
string in canonical representation. */
PyAPI_FUNC
(
int
)
PyUnicode_Resize
(
PyAPI_FUNC
(
int
)
PyUnicode_Resize
(
PyObject
**
unicode
,
/* Pointer to the Unicode object */
PyObject
**
unicode
,
/* Pointer to the Unicode object */
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
16e6a809
...
@@ -5040,7 +5040,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s,
...
@@ -5040,7 +5040,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s,
*consumed = (const char *)q-starts;
*consumed = (const char *)q-starts;
/* Adjust length */
/* Adjust length */
if (
PyUnicode_R
esize(&unicode, outpos) < 0)
if (
unicode_r
esize(&unicode, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
...
@@ -5404,7 +5404,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
...
@@ -5404,7 +5404,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
*consumed = (const char *)q-starts;
*consumed = (const char *)q-starts;
/* Adjust length */
/* Adjust length */
if (
PyUnicode_R
esize(&unicode, outpos) < 0)
if (
unicode_r
esize(&unicode, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
...
@@ -5824,7 +5824,7 @@ PyUnicode_DecodeUnicodeEscape(const char *s,
...
@@ -5824,7 +5824,7 @@ PyUnicode_DecodeUnicodeEscape(const char *s,
}
}
#undef WRITECHAR
#undef WRITECHAR
if (
PyUnicode_R
esize(&v, i) < 0)
if (
unicode_r
esize(&v, i) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
Py_XDECREF(exc);
...
@@ -6086,7 +6086,7 @@ PyUnicode_DecodeRawUnicodeEscape(const char *s,
...
@@ -6086,7 +6086,7 @@ PyUnicode_DecodeRawUnicodeEscape(const char *s,
nextByte:
nextByte:
;
;
}
}
if (
PyUnicode_R
esize(&v, outpos) < 0)
if (
unicode_r
esize(&v, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
Py_XDECREF(exc);
...
@@ -6273,7 +6273,7 @@ _PyUnicode_DecodeUnicodeInternal(const char *s,
...
@@ -6273,7 +6273,7 @@ _PyUnicode_DecodeUnicodeInternal(const char *s,
goto onError;
goto onError;
}
}
if (
PyUnicode_R
esize(&v, outpos) < 0)
if (
unicode_r
esize(&v, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
Py_XDECREF(exc);
...
@@ -6727,7 +6727,7 @@ PyUnicode_DecodeASCII(const char *s,
...
@@ -6727,7 +6727,7 @@ PyUnicode_DecodeASCII(const char *s,
data = PyUnicode_DATA(v);
data = PyUnicode_DATA(v);
}
}
}
}
if (
PyUnicode_R
esize(&v, outpos) < 0)
if (
unicode_r
esize(&v, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
Py_XDECREF(exc);
...
@@ -6874,7 +6874,7 @@ decode_code_page_strict(UINT code_page,
...
@@ -6874,7 +6874,7 @@ decode_code_page_strict(UINT code_page,
else {
else {
/* Extend unicode object */
/* Extend unicode object */
Py_ssize_t n = PyUnicode_GET_SIZE(*v);
Py_ssize_t n = PyUnicode_GET_SIZE(*v);
if (
PyUnicode_R
esize(v, n + outsize) < 0)
if (
unicode_r
esize(v, n + outsize) < 0)
return -1;
return -1;
out = PyUnicode_AS_UNICODE(*v) + n;
out = PyUnicode_AS_UNICODE(*v) + n;
}
}
...
@@ -6958,7 +6958,7 @@ decode_code_page_errors(UINT code_page,
...
@@ -6958,7 +6958,7 @@ decode_code_page_errors(UINT code_page,
PyErr_NoMemory();
PyErr_NoMemory();
goto error;
goto error;
}
}
if (
PyUnicode_R
esize(v, n + size * Py_ARRAY_LENGTH(buffer)) < 0)
if (
unicode_r
esize(v, n + size * Py_ARRAY_LENGTH(buffer)) < 0)
goto error;
goto error;
startout = PyUnicode_AS_UNICODE(*v) + n;
startout = PyUnicode_AS_UNICODE(*v) + n;
}
}
...
@@ -7017,7 +7017,7 @@ decode_code_page_errors(UINT code_page,
...
@@ -7017,7 +7017,7 @@ decode_code_page_errors(UINT code_page,
/* Extend unicode object */
/* Extend unicode object */
outsize = out - startout;
outsize = out - startout;
assert(outsize <= PyUnicode_WSTR_LENGTH(*v));
assert(outsize <= PyUnicode_WSTR_LENGTH(*v));
if (
PyUnicode_R
esize(v, outsize) < 0)
if (
unicode_r
esize(v, outsize) < 0)
goto error;
goto error;
ret = size;
ret = size;
...
@@ -7664,8 +7664,9 @@ PyUnicode_DecodeCharmap(const char *s,
...
@@ -7664,8 +7664,9 @@ PyUnicode_DecodeCharmap(const char *s,
(targetsize << 2);
(targetsize << 2);
extrachars += needed;
extrachars += needed;
/* XXX overflow detection missing */
/* XXX overflow detection missing */
if (PyUnicode_Resize(&v,
if (unicode_resize(&v,
PyUnicode_GET_LENGTH(v) + needed) < 0) {
PyUnicode_GET_LENGTH(v) + needed) < 0)
{
Py_DECREF(x);
Py_DECREF(x);
goto onError;
goto onError;
}
}
...
@@ -7689,7 +7690,7 @@ PyUnicode_DecodeCharmap(const char *s,
...
@@ -7689,7 +7690,7 @@ PyUnicode_DecodeCharmap(const char *s,
++s;
++s;
}
}
}
}
if (
PyUnicode_R
esize(&v, outpos) < 0)
if (
unicode_r
esize(&v, outpos) < 0)
goto onError;
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
Py_XDECREF(exc);
...
...
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