File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -249,11 +249,11 @@ PyTypeObject DiffIterType = {
249249 (iternextfunc ) DiffIter_iternext , /* tp_iternext */
250250};
251251
252- PyDoc_STRVAR (Diff_size__doc__ , "Returns the number of deltas/patches in this diff." );
253- PyObject *
254- Diff_size__get__ (Diff * self )
252+ Py_ssize_t
253+ Diff_len (Diff * self )
255254{
256- return PyLong_FromSize_t (git_diff_num_deltas (self -> list ));
255+ assert (self -> list );
256+ return (Py_ssize_t )git_diff_num_deltas (self -> list );
257257}
258258
259259PyDoc_STRVAR (Diff_patch__doc__ , "Patch diff string." );
@@ -446,12 +446,11 @@ Diff_dealloc(Diff *self)
446446
447447PyGetSetDef Diff_getseters [] = {
448448 GETTER (Diff , patch ),
449- GETTER (Diff , size ),
450449 {NULL }
451450};
452451
453452PyMappingMethods Diff_as_mapping = {
454- 0 , /* mp_length */
453+ ( lenfunc ) Diff_len , /* mp_length */
455454 (binaryfunc )Diff_getitem , /* mp_subscript */
456455 0 , /* mp_ass_subscript */
457456};
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ def test_diff_patch(self):
254254
255255 diff = commit_a .tree .diff_to_tree (commit_b .tree )
256256 self .assertEqual (diff .patch , PATCH )
257- self .assertEqual (diff . size , len ([patch for patch in diff ]))
257+ self .assertEqual (len ( diff ) , len ([patch for patch in diff ]))
258258
259259 def test_diff_oids (self ):
260260 commit_a = self .repo [COMMIT_SHA1_1 ]
You can’t perform that action at this time.
0 commit comments