Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33b5601

Browse files
authored
Merge pull request #17346 from QuLogic/backports
Backport #17084 and #17210 to v3.2.x
2 parents 14928b3 + ca714c1 commit 33b5601

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ def __call__(self, orig, dest):
211211
# Inkscape's output is not localized but gtk's is, so the output
212212
# stream probably has a mixed encoding. Using the filesystem
213213
# encoding should at least get the filenames right...
214-
self._stderr.seek(0)
214+
self._proc.stderr.seek(0)
215215
raise ImageComparisonFailure(
216-
self._stderr.read().decode(
216+
self._proc.stderr.read().decode(
217217
sys.getfilesystemencoding(), "replace"))
218218

219219

src/_macosx.m

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ static int wait_for_stdin(void)
138138
}
139139

140140
NSEvent* event;
141-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
142141
while (true) {
143142
while (true) {
144143
event = [NSApp nextEventMatchingMask: NSAnyEventMask
@@ -151,7 +150,6 @@ static int wait_for_stdin(void)
151150
CFRunLoopRun();
152151
if (interrupted || CFReadStreamHasBytesAvailable(stream)) break;
153152
}
154-
[pool release];
155153

156154
if (py_sigint_handler) PyOS_setsig(SIGINT, py_sigint_handler);
157155
CFReadStreamUnscheduleFromRunLoop(stream,
@@ -280,15 +278,13 @@ static void lazy_init(void) {
280278
PyOS_InputHook = wait_for_stdin;
281279
#endif
282280

283-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
284281
WindowServerConnectionManager* connectionManager = [WindowServerConnectionManager sharedManager];
285282
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
286283
NSNotificationCenter* notificationCenter = [workspace notificationCenter];
287284
[notificationCenter addObserver: connectionManager
288285
selector: @selector(launch:)
289286
name: NSWorkspaceDidLaunchApplicationNotification
290287
object: nil];
291-
[pool release];
292288
}
293289

294290
static PyObject*
@@ -366,11 +362,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
366362

367363
if(view) /* The figure may have been closed already */
368364
{
369-
/* Whereas drawRect creates its own autorelease pool, apparently
370-
* [view display] also needs one. Create and release it here. */
371-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
372365
[view display];
373-
[pool release];
374366
}
375367

376368
Py_RETURN_NONE;
@@ -546,7 +538,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
546538
close(channel[0]);
547539
}
548540

549-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
550541
NSDate* date =
551542
(timeout > 0.0) ? [NSDate dateWithTimeIntervalSinceNow: timeout]
552543
: [NSDate distantFuture];
@@ -558,7 +549,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
558549
if (!event || [event type]==NSApplicationDefined) break;
559550
[NSApp sendEvent: event];
560551
}
561-
[pool release];
562552

563553
if (py_sigint_handler) PyOS_setsig(SIGINT, py_sigint_handler);
564554

@@ -731,7 +721,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
731721
rect.size.height = height;
732722
rect.size.width = width;
733723

734-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
735724
self->window = [self->window initWithContentRect: rect
736725
styleMask: NSTitledWindowMask
737726
| NSClosableWindowMask
@@ -749,7 +738,6 @@ static CGFloat _get_device_scale(CGContextRef cr)
749738
[window makeFirstResponder: view];
750739
[[window contentView] addSubview: view];
751740

752-
[pool release];
753741
return 0;
754742
}
755743

@@ -766,9 +754,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
766754
Window* window = self->window;
767755
if(window)
768756
{
769-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
770757
[window close];
771-
[pool release];
772758
}
773759
Py_TYPE(self)->tp_free((PyObject*)self);
774760
}
@@ -779,10 +765,8 @@ static CGFloat _get_device_scale(CGContextRef cr)
779765
Window* window = self->window;
780766
if(window)
781767
{
782-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
783768
[window makeKeyAndOrderFront: nil];
784769
[window orderFrontRegardless];
785-
[pool release];
786770
}
787771
Py_RETURN_NONE;
788772
}
@@ -793,9 +777,7 @@ static CGFloat _get_device_scale(CGContextRef cr)
793777
Window* window = self->window;
794778
if(window)
795779
{
796-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
797780
[window close];
798-
[pool release];
799781
self->window = NULL;
800782
}
801783
Py_RETURN_NONE;
@@ -812,12 +794,10 @@ static CGFloat _get_device_scale(CGContextRef cr)
812794
Window* window = self->window;
813795
if(window)
814796
{
815-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
816797
NSString* ns_title = [[[NSString alloc]
817798
initWithCString: title
818799
encoding: NSUTF8StringEncoding] autorelease];
819800
[window setTitle: ns_title];
820-
[pool release];
821801
}
822802
Py_RETURN_NONE;
823803
}
@@ -829,13 +809,11 @@ static CGFloat _get_device_scale(CGContextRef cr)
829809
PyObject* result = NULL;
830810
if(window)
831811
{
832-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
833812
NSString* title = [window title];
834813
if (title) {
835814
const char* cTitle = [title UTF8String];
836815
result = PyUnicode_FromString(cTitle);
837816
}
838-
[pool release];
839817
}
840818
if (result) {
841819
return result;
@@ -1164,7 +1142,6 @@ -(void)save_figure:(id)sender
11641142

11651143
if(!PyArg_ParseTuple(args, "s", &basedir)) return -1;
11661144

1167-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
11681145
NSRect bounds = [view bounds];
11691146
NSWindow* window = [view window];
11701147

@@ -1265,8 +1242,6 @@ -(void)save_figure:(id)sender
12651242
[messagebox release];
12661243
[[window contentView] display];
12671244

1268-
[pool release];
1269-
12701245
self->messagebox = messagebox;
12711246
return 0;
12721247
}
@@ -1297,10 +1272,9 @@ -(void)save_figure:(id)sender
12971272
NSText* messagebox = self->messagebox;
12981273

12991274
if (messagebox)
1300-
{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
1275+
{
13011276
NSString* text = [NSString stringWithUTF8String: message];
13021277
[messagebox setString: text];
1303-
[pool release];
13041278
}
13051279

13061280
Py_RETURN_NONE;
@@ -2349,14 +2323,12 @@ - (int)index
23492323
show(PyObject* self)
23502324
{
23512325
[NSApp activateIgnoringOtherApps: YES];
2352-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
23532326
NSArray *windowsArray = [NSApp windows];
23542327
NSEnumerator *enumerator = [windowsArray objectEnumerator];
23552328
NSWindow *window;
23562329
while ((window = [enumerator nextObject])) {
23572330
[window orderFront:nil];
23582331
}
2359-
[pool release];
23602332
Py_BEGIN_ALLOW_THREADS
23612333
[NSApp run];
23622334
Py_END_ALLOW_THREADS

0 commit comments

Comments
 (0)