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
765531d2
Kaydet (Commit)
765531d2
authored
Mar 26, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17516: use comment syntax for comments, instead of multiline string
üst
1f8898a5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
187 additions
and
200 deletions
+187
-200
__init__.py
Lib/ctypes/__init__.py
+9
-11
test_internals.py
Lib/ctypes/test/test_internals.py
+8
-11
test_macholib.py
Lib/ctypes/test/test_macholib.py
+27
-29
datetime.py
Lib/datetime.py
+0
-0
_header_value_parser.py
Lib/email/_header_value_parser.py
+16
-18
_bootstrap.py
Lib/importlib/_bootstrap.py
+93
-94
handlers.py
Lib/logging/handlers.py
+3
-4
pickletools.py
Lib/pickletools.py
+0
-0
test_getargs2.py
Lib/test/test_getargs2.py
+29
-31
ElementTree.py
Lib/xml/etree/ElementTree.py
+1
-1
reindent.py
Tools/scripts/reindent.py
+1
-1
No files found.
Lib/ctypes/__init__.py
Dosyayı görüntüle @
765531d2
...
...
@@ -34,17 +34,15 @@ from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \
FUNCFLAG_USE_ERRNO
as
_FUNCFLAG_USE_ERRNO
,
\
FUNCFLAG_USE_LASTERROR
as
_FUNCFLAG_USE_LASTERROR
"""
WINOLEAPI -> HRESULT
WINOLEAPI_(type)
STDMETHODCALLTYPE
STDMETHOD(name)
STDMETHOD_(type, name)
STDAPICALLTYPE
"""
# WINOLEAPI -> HRESULT
# WINOLEAPI_(type)
#
# STDMETHODCALLTYPE
#
# STDMETHOD(name)
# STDMETHOD_(type, name)
#
# STDAPICALLTYPE
def
create_string_buffer
(
init
,
size
=
None
):
"""create_string_buffer(aBytes) -> character array
...
...
Lib/ctypes/test/test_internals.py
Dosyayı görüntüle @
765531d2
...
...
@@ -5,17 +5,14 @@ from sys import getrefcount as grc
# XXX This test must be reviewed for correctness!!!
"""
ctypes' types are container types.
They have an internal memory block, which only consists of some bytes,
but it has to keep references to other objects as well. This is not
really needed for trivial C types like int or char, but it is important
for aggregate types like strings or pointers in particular.
What about pointers?
"""
# ctypes' types are container types.
#
# They have an internal memory block, which only consists of some bytes,
# but it has to keep references to other objects as well. This is not
# really needed for trivial C types like int or char, but it is important
# for aggregate types like strings or pointers in particular.
#
# What about pointers?
class
ObjectsTestCase
(
unittest
.
TestCase
):
def
assertSame
(
self
,
a
,
b
):
...
...
Lib/ctypes/test/test_macholib.py
Dosyayı görüntüle @
765531d2
...
...
@@ -3,35 +3,33 @@ import sys
import
unittest
# Bob Ippolito:
"""
Ok.. the code to find the filename for __getattr__ should look
something like:
import os
from macholib.dyld import dyld_find
def find_lib(name):
possible = ['lib'+name+'.dylib', name+'.dylib',
name+'.framework/'+name]
for dylib in possible:
try:
return os.path.realpath(dyld_find(dylib))
except ValueError:
pass
raise ValueError, "
%
s not found"
%
(name,)
It'll have output like this:
>>> find_lib('pthread')
'/usr/lib/libSystem.B.dylib'
>>> find_lib('z')
'/usr/lib/libz.1.dylib'
>>> find_lib('IOKit')
'/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit'
-bob
"""
#
# Ok.. the code to find the filename for __getattr__ should look
# something like:
#
# import os
# from macholib.dyld import dyld_find
#
# def find_lib(name):
# possible = ['lib'+name+'.dylib', name+'.dylib',
# name+'.framework/'+name]
# for dylib in possible:
# try:
# return os.path.realpath(dyld_find(dylib))
# except ValueError:
# pass
# raise ValueError, "%s not found" % (name,)
#
# It'll have output like this:
#
# >>> find_lib('pthread')
# '/usr/lib/libSystem.B.dylib'
# >>> find_lib('z')
# '/usr/lib/libz.1.dylib'
# >>> find_lib('IOKit')
# '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit'
#
# -bob
from
ctypes.macholib.dyld
import
dyld_find
...
...
Lib/datetime.py
Dosyayı görüntüle @
765531d2
This diff is collapsed.
Click to expand it.
Lib/email/_header_value_parser.py
Dosyayı görüntüle @
765531d2
...
...
@@ -1317,24 +1317,22 @@ RouteComponentMarker = ValueTerminal('@', 'route-component-marker')
# Parser
#
"""Parse strings according to RFC822/2047/2822/5322 rules.
This is a stateless parser. Each get_XXX function accepts a string and
returns either a Terminal or a TokenList representing the RFC object named
by the method and a string containing the remaining unparsed characters
from the input. Thus a parser method consumes the next syntactic construct
of a given type and returns a token representing the construct plus the
unparsed remainder of the input string.
For example, if the first element of a structured header is a 'phrase',
then:
phrase, value = get_phrase(value)
returns the complete phrase from the start of the string value, plus any
characters left in the string after the phrase is removed.
"""
# Parse strings according to RFC822/2047/2822/5322 rules.
#
# This is a stateless parser. Each get_XXX function accepts a string and
# returns either a Terminal or a TokenList representing the RFC object named
# by the method and a string containing the remaining unparsed characters
# from the input. Thus a parser method consumes the next syntactic construct
# of a given type and returns a token representing the construct plus the
# unparsed remainder of the input string.
#
# For example, if the first element of a structured header is a 'phrase',
# then:
#
# phrase, value = get_phrase(value)
#
# returns the complete phrase from the start of the string value, plus any
# characters left in the string after the phrase is removed.
_wsp_splitter
=
re
.
compile
(
r'([{}]+)'
.
format
(
''
.
join
(
WSP
)))
.
split
_non_atom_end_matcher
=
re
.
compile
(
r"[^{}]+"
.
format
(
...
...
Lib/importlib/_bootstrap.py
Dosyayı görüntüle @
765531d2
...
...
@@ -299,101 +299,100 @@ def _call_with_frames_removed(f, *args, **kwds):
# Finder/loader utility code ###############################################
"""
Magic word to reject .pyc files generated by other Python versions.
It should change for each incompatible change to the bytecode.
The value of CR and LF is incorporated so if you ever read or write
a .pyc file in text mode the magic number will be wrong; also, the
Apple MPW compiler swaps their values, botching string constants.
The magic numbers must be spaced apart at least 2 values, as the
-U interpeter flag will cause MAGIC+1 being used. They have been
odd numbers for some time now.
There were a variety of old schemes for setting the magic number.
The current working scheme is to increment the previous value by
10.
Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic
number also includes a new "magic tag", i.e. a human readable string used
to represent the magic number in __pycache__ directories. When you change
the magic number, you must also set a new unique magic tag. Generally this
can be named after the Python major version of the magic number bump, but
it can really be anything, as long as it's different than anything else
that's come before. The tags are included in the following table, starting
with Python 3.2a0.
Known values:
Python 1.5: 20121
Python 1.5.1: 20121
Python 1.5.2: 20121
Python 1.6: 50428
Python 2.0: 50823
Python 2.0.1: 50823
Python 2.1: 60202
Python 2.1.1: 60202
Python 2.1.2: 60202
Python 2.2: 60717
Python 2.3a0: 62011
Python 2.3a0: 62021
Python 2.3a0: 62011 (!)
Python 2.4a0: 62041
Python 2.4a3: 62051
Python 2.4b1: 62061
Python 2.5a0: 62071
Python 2.5a0: 62081 (ast-branch)
Python 2.5a0: 62091 (with)
Python 2.5a0: 62092 (changed WITH_CLEANUP opcode)
Python 2.5b3: 62101 (fix wrong code: for x, in ...)
Python 2.5b3: 62111 (fix wrong code: x += yield)
Python 2.5c1: 62121 (fix wrong lnotab with for loops and
storing constants that should have been removed)
Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp)
Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode)
Python 2.6a1: 62161 (WITH_CLEANUP optimization)
Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND)
Python 2.7a0: 62181 (optimize conditional branches:
introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
Python 2.7a0 62191 (introduce SETUP_WITH)
Python 2.7a0 62201 (introduce BUILD_SET)
Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD)
Python 3000: 3000
3010 (removed UNARY_CONVERT)
3020 (added BUILD_SET)
3030 (added keyword-only parameters)
3040 (added signature annotations)
3050 (print becomes a function)
3060 (PEP 3115 metaclass syntax)
3061 (string literals become unicode)
3071 (PEP 3109 raise changes)
3081 (PEP 3137 make __file__ and __name__ unicode)
3091 (kill str8 interning)
3101 (merge from 2.6a0, see 62151)
3103 (__file__ points to source file)
Python 3.0a4: 3111 (WITH_CLEANUP optimization).
Python 3.0a5: 3131 (lexical exception stacking, including POP_EXCEPT)
Python 3.1a0: 3141 (optimize list, set and dict comprehensions:
change LIST_APPEND and SET_ADD, add MAP_ADD)
Python 3.1a0: 3151 (optimize conditional branches:
introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
Python 3.2a0: 3160 (add SETUP_WITH)
tag: cpython-32
Python 3.2a1: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR)
tag: cpython-32
Python 3.2a2 3180 (add DELETE_DEREF)
Python 3.3a0 3190 __class__ super closure changed
Python 3.3a0 3200 (__qualname__ added)
3210 (added size modulo 2**32 to the pyc header)
Python 3.3a1 3220 (changed PEP 380 implementation)
Python 3.3a4 3230 (revert changes to implicit __class__ closure)
Python 3.4a1 3250 (evaluate positional default arguments before
keyword-only defaults)
MAGIC must change whenever the bytecode emitted by the compiler may no
longer be understood by older implementations of the eval loop (usually
due to the addition of new opcodes).
#
Magic word to reject .pyc files generated by other Python versions.
#
It should change for each incompatible change to the bytecode.
#
#
The value of CR and LF is incorporated so if you ever read or write
#
a .pyc file in text mode the magic number will be wrong; also, the
#
Apple MPW compiler swaps their values, botching string constants.
#
#
The magic numbers must be spaced apart at least 2 values, as the
#
-U interpeter flag will cause MAGIC+1 being used. They have been
#
odd numbers for some time now.
#
#
There were a variety of old schemes for setting the magic number.
#
The current working scheme is to increment the previous value by
#
10.
#
#
Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic
#
number also includes a new "magic tag", i.e. a human readable string used
#
to represent the magic number in __pycache__ directories. When you change
#
the magic number, you must also set a new unique magic tag. Generally this
#
can be named after the Python major version of the magic number bump, but
#
it can really be anything, as long as it's different than anything else
#
that's come before. The tags are included in the following table, starting
#
with Python 3.2a0.
#
#
Known values:
#
Python 1.5: 20121
#
Python 1.5.1: 20121
#
Python 1.5.2: 20121
#
Python 1.6: 50428
#
Python 2.0: 50823
#
Python 2.0.1: 50823
#
Python 2.1: 60202
#
Python 2.1.1: 60202
#
Python 2.1.2: 60202
#
Python 2.2: 60717
#
Python 2.3a0: 62011
#
Python 2.3a0: 62021
#
Python 2.3a0: 62011 (!)
#
Python 2.4a0: 62041
#
Python 2.4a3: 62051
#
Python 2.4b1: 62061
#
Python 2.5a0: 62071
#
Python 2.5a0: 62081 (ast-branch)
#
Python 2.5a0: 62091 (with)
#
Python 2.5a0: 62092 (changed WITH_CLEANUP opcode)
#
Python 2.5b3: 62101 (fix wrong code: for x, in ...)
#
Python 2.5b3: 62111 (fix wrong code: x += yield)
#
Python 2.5c1: 62121 (fix wrong lnotab with for loops and
#
storing constants that should have been removed)
#
Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp)
#
Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode)
#
Python 2.6a1: 62161 (WITH_CLEANUP optimization)
#
Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND)
#
Python 2.7a0: 62181 (optimize conditional branches:
#
introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
#
Python 2.7a0 62191 (introduce SETUP_WITH)
#
Python 2.7a0 62201 (introduce BUILD_SET)
#
Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD)
#
Python 3000: 3000
#
3010 (removed UNARY_CONVERT)
#
3020 (added BUILD_SET)
#
3030 (added keyword-only parameters)
#
3040 (added signature annotations)
#
3050 (print becomes a function)
#
3060 (PEP 3115 metaclass syntax)
#
3061 (string literals become unicode)
#
3071 (PEP 3109 raise changes)
#
3081 (PEP 3137 make __file__ and __name__ unicode)
#
3091 (kill str8 interning)
#
3101 (merge from 2.6a0, see 62151)
#
3103 (__file__ points to source file)
#
Python 3.0a4: 3111 (WITH_CLEANUP optimization).
#
Python 3.0a5: 3131 (lexical exception stacking, including POP_EXCEPT)
#
Python 3.1a0: 3141 (optimize list, set and dict comprehensions:
#
change LIST_APPEND and SET_ADD, add MAP_ADD)
#
Python 3.1a0: 3151 (optimize conditional branches:
#
introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
#
Python 3.2a0: 3160 (add SETUP_WITH)
#
tag: cpython-32
#
Python 3.2a1: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR)
#
tag: cpython-32
#
Python 3.2a2 3180 (add DELETE_DEREF)
#
Python 3.3a0 3190 __class__ super closure changed
#
Python 3.3a0 3200 (__qualname__ added)
#
3210 (added size modulo 2**32 to the pyc header)
#
Python 3.3a1 3220 (changed PEP 380 implementation)
#
Python 3.3a4 3230 (revert changes to implicit __class__ closure)
#
Python 3.4a1 3250 (evaluate positional default arguments before
#
keyword-only defaults)
#
#
MAGIC must change whenever the bytecode emitted by the compiler may no
#
longer be understood by older implementations of the eval loop (usually
#
due to the addition of new opcodes).
"""
_MAGIC_BYTES
=
(
3250
)
.
to_bytes
(
2
,
'little'
)
+
b
'
\r\n
'
_RAW_MAGIC_NUMBER
=
int
.
from_bytes
(
_MAGIC_BYTES
,
'little'
)
...
...
Lib/logging/handlers.py
Dosyayı görüntüle @
765531d2
...
...
@@ -825,10 +825,9 @@ class SysLogHandler(logging.Handler):
msg
=
self
.
ident
+
msg
if
self
.
append_nul
:
msg
+=
'
\000
'
"""
We need to convert record level to lowercase, maybe this will
change in the future.
"""
# We need to convert record level to lowercase, maybe this will
# change in the future.
prio
=
'<
%
d>'
%
self
.
encodePriority
(
self
.
facility
,
self
.
mapPriority
(
record
.
levelname
))
prio
=
prio
.
encode
(
'utf-8'
)
...
...
Lib/pickletools.py
Dosyayı görüntüle @
765531d2
This diff is collapsed.
Click to expand it.
Lib/test/test_getargs2.py
Dosyayı görüntüle @
765531d2
...
...
@@ -2,37 +2,35 @@ import unittest
from
test
import
support
from
_testcapi
import
getargs_keywords
,
getargs_keyword_only
"""
> How about the following counterproposal. This also changes some of
> the other format codes to be a little more regular.
>
> Code C type Range check
>
> b unsigned char 0..UCHAR_MAX
> h signed short SHRT_MIN..SHRT_MAX
> B unsigned char none **
> H unsigned short none **
> k * unsigned long none
> I * unsigned int 0..UINT_MAX
> i int INT_MIN..INT_MAX
> l long LONG_MIN..LONG_MAX
> K * unsigned long long none
> L long long LLONG_MIN..LLONG_MAX
> Notes:
>
> * New format codes.
>
> ** Changed from previous "range-and-a-half" to "none"; the
> range-and-a-half checking wasn't particularly useful.
Plus a C API or two, e.g. PyInt_AsLongMask() ->
unsigned long and PyInt_AsLongLongMask() -> unsigned
long long (if that exists).
"""
# > How about the following counterproposal. This also changes some of
# > the other format codes to be a little more regular.
# >
# > Code C type Range check
# >
# > b unsigned char 0..UCHAR_MAX
# > h signed short SHRT_MIN..SHRT_MAX
# > B unsigned char none **
# > H unsigned short none **
# > k * unsigned long none
# > I * unsigned int 0..UINT_MAX
#
#
# > i int INT_MIN..INT_MAX
# > l long LONG_MIN..LONG_MAX
#
# > K * unsigned long long none
# > L long long LLONG_MIN..LLONG_MAX
#
# > Notes:
# >
# > * New format codes.
# >
# > ** Changed from previous "range-and-a-half" to "none"; the
# > range-and-a-half checking wasn't particularly useful.
#
# Plus a C API or two, e.g. PyInt_AsLongMask() ->
# unsigned long and PyInt_AsLongLongMask() -> unsigned
# long long (if that exists).
LARGE
=
0x7FFFFFFF
VERY_LARGE
=
0xFF0000121212121212121242
...
...
Lib/xml/etree/ElementTree.py
Dosyayı görüntüle @
765531d2
...
...
@@ -1337,8 +1337,8 @@ def XMLID(text, parser=None):
ids
[
id
]
=
elem
return
tree
,
ids
# Parse XML document from string constant. Alias for XML().
fromstring
=
XML
"""Parse XML document from string constant. Alias for XML()."""
def
fromstringlist
(
sequence
,
parser
=
None
):
"""Parse XML document from sequence of string fragments.
...
...
Tools/scripts/reindent.py
Dosyayı görüntüle @
765531d2
...
...
@@ -52,8 +52,8 @@ verbose = False
recurse
=
False
dryrun
=
False
makebackup
=
True
# A specified newline to be used in the output (set by --newline option)
spec_newline
=
None
"""A specified newline to be used in the output (set by --newline option)"""
def
usage
(
msg
=
None
):
...
...
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