<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">There seems to be something whacky with the type annotations for np.sinc that causes mypy to later think that an array is a boolean array when clearly it is not. See the reproducing code below. This seems to have started with numpy 1.22 (presumably due to the more accuracy dtype annotations). Changing <code class="notranslate">np.sinc</code> to <code class="notranslate">np.sin</code> or <code class="notranslate">np.exp</code> makes the problem disappear, which is why I assume it is specific to <code class="notranslate">sinc</code>.</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np

def what_the() -&gt; None:
    idx = np.arange(16, dtype=float)
    c = idx * np.sinc(idx)
    c /= np.sum(c)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-k">def</span> <span class="pl-en">what_the</span>() <span class="pl-c1">-&gt;</span> <span class="pl-c1">None</span>:
    <span class="pl-s1">idx</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">16</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">float</span>)
    <span class="pl-s1">c</span> <span class="pl-c1">=</span> <span class="pl-s1">idx</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-en">sinc</span>(<span class="pl-s1">idx</span>)
    <span class="pl-s1">c</span> <span class="pl-c1">/=</span> <span class="pl-s1">np</span>.<span class="pl-en">sum</span>(<span class="pl-s1">c</span>)</pre></div>
<h3 dir="auto">Error message:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Error message from mypy 0.961:


show_type.py:6: error: Invalid self argument &quot;ndarray[Any, dtype[bool_]]&quot; to attribute function &quot;__itruediv__&quot; with type &quot;Callable[[ndarray[Any, dtype[floating[_NBit1]]], Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]]], bool, int, float, _NestedSequence[Union[bool, int, float]]]], ndarray[Any, dtype[floating[_NBit1]]]]&quot;"><pre class="notranslate">Error message from mypy 0.961:


show_type.py:6: error: Invalid self argument <span class="pl-s"><span class="pl-pds">"</span>ndarray[Any, dtype[bool_]]<span class="pl-pds">"</span></span> to attribute <span class="pl-k">function</span> <span class="pl-en">"__itruediv__"</span> with <span class="pl-c1">type</span> <span class="pl-s"><span class="pl-pds">"</span>Callable[[ndarray[Any, dtype[floating[_NBit1]]], Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]]], bool, int, float, _NestedSequence[Union[bool, int, float]]]], ndarray[Any, dtype[floating[_NBit1]]]]<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">Note the <code class="notranslate">bool_</code> on the first line.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="

### NumPy/Python version information:

1.23.0 3.10.5 (main, Jun 11 2022, 16:53:24) [GCC 9.4.0]"><pre class="notranslate"><code class="notranslate">

### NumPy/Python version information:

1.23.0 3.10.5 (main, Jun 11 2022, 16:53:24) [GCC 9.4.0]
</code></pre></div>
<p dir="auto">I am sending a file from front end to backend, i have also installed cors extension for the browser but got badly engaged with the error: I have tried a lot i performed debugging. I also added the cors in the flask, i added some code in the function of component.html to perform manual debugging. Previously i was receiving the error of cors disabled the response but it got resolved by adding cors in the browser:</p>
<p dir="auto">App.py:</p>
<p dir="auto">import csv<br>
from flask import make_response, url_for<br>
from flask import Flask, jsonify,render_template<br>
from flask_cors import CORS, cross_origin<br>
from werkzeug.utils import secure_filename</p>
<h1 dir="auto">from flask_restful import Resource, Api;</h1>
<p dir="auto">from flask import Flask, render_template, request, redirect<br>
import matplotlib.pyplot as plt<br>
from test import test<br>
app = Flask(<strong>name</strong>)<br>
#cors = CORS(app, resources={r"/api/<a href="http://localhost:4200" rel="nofollow">http://localhost:4200</a>": {"origins": "<a href="http://localhost:4200%22%7D%7D)#" rel="nofollow">http://localhost:4200"}})#</a> api = Api(app)<br>
CORS(app, supports_credentials=True)<br>
app.register_blueprint(test,url_prefix="/admin")</p>
<p dir="auto">@app.route('/uploader', methods = ['POST','GET'])<br>
#@cross_origin(["http://localhost:4200"])<br>
@cross_origin(allow_headers=['http://localhost:4200'])<br>
def upload_file():<br>
print(request.files)<br>
# check if the post request has the file part<br>
if 'file' not in request.files:<br>
print('no file in request')<br>
return"no file in request"<br>
file = request.files['file']<br>
if file.filename == '':<br>
print('no selected file')<br>
return"no selected file"<br>
if file and allowed_file(file.filename):<br>
print("hello")<br>
filename = secure_filename(file.filename)<br>
#file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))<br>
return "Successful"<br>
print("end")<br>
return"Bye"<br>
@app.route('/')<br>
def index():<br>
return  ('This is the main page of Python and calling the index function')</p>
<p dir="auto">weather =  {<br>
"data":[ {<br>
"day":"1/6/2019",<br>
"temperature":"23",<br>
"windspeed":"16",<br>
"event":"Sunny"<br>
},  {<br>
"day":"5/6/2019",<br>
"temperature":"17",<br>
"windspeed":"18",<br>
"event":"Rainy"<br>
},  {<br>
"day":"6/6/2019",<br>
"temperature":"19",<br>
"windspeed":"21",<br>
"event":"Rainy"<br>
},  {<br>
"day":"7/6/2019",<br>
"temperature":"28",<br>
"windspeed":"14",<br>
"event":"Sunny"<br>
}<br>
]<br>
}</p>
<p dir="auto">@app.route("/weatherReport/", methods = ['GET'])</p>
<p dir="auto">def WeatherReport():<br>
global weather<br>
return jsonify([weather])<br>
if <strong>name</strong> == '<strong>main</strong>':<br>
app.run(debug = True)<br>
component.ts:</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ViewChild/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ViewChild">@ViewChild</a>('fileInput') fileInput;<br>
ngOnInit() {<br>
this.todaydate = this.myservice.showTodayDate();<br>
}<br>
handleFileInput(files: FileList) {<br>
console.log('Inside handleFileInput');<br>
this.receivedFile = files.item(0);<br>
const isFileupload = true;<br>
console.log(<code class="notranslate"> Received File: ${this.receivedFile}</code>);</p>
<p dir="auto">}</p>
<p dir="auto">uploadFile() {<br>
console.log('Inside  uploadFile');<br>
const files: FileList = this.fileInput.nativeElement.files;<br>
console.log('Inside  uploadFile line 02');<br>
if (files.length === 0) {<br>
console.log('Inside  uploadFile 03');<br>
console.log('no file content here');<br>
console.log('Inside  uploadFile 04');<br>
return;<br>
};<br>
console.log('Inside  uploadFile 05');</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="this.restservice.parseTable(files).subscribe((data: any) =&gt; {
  console.log('Inside  uploadFile 06');
  console.log('Data that i am sending: ' + data);
},  "><pre class="notranslate"><code class="notranslate">this.restservice.parseTable(files).subscribe((data: any) =&gt; {
  console.log('Inside  uploadFile 06');
  console.log('Data that i am sending: ' + data);
},  
</code></pre></div>
<p dir="auto">//at here the error block is executing;<br>
(error) =&gt; {<br>
console.log('Inside uploadFile 07');<br>
console.log('No Data Found' + error);<br>
});<br>
}<br>
}<br>
service.ts:</p>
<p dir="auto">parseTable(files) {<br>
const formData: FormData = new FormData();<br>
formData.append('file', files[0], files[0].name);<br>
return this.http.post(this.backendAddress, formData);<br>
}<br>
component.html:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="      &lt;input #fileInput name=&quot;file&quot; type=&quot;file&quot;  (change)=&quot;handleFileInput($event.target.files)&quot; &gt;"><pre class="notranslate"><code class="notranslate">      &lt;input #fileInput name="file" type="file"  (change)="handleFileInput($event.target.files)" &gt;
</code></pre></div>
<p dir="auto">&lt;button mat-raised-button class="standard-button" (click)="uploadFile()"&gt;Upload file<br>
Error</p>
<p dir="auto"><em>POST <a href="http://localhost:5000/uploader" rel="nofollow">http://localhost:5000/uploader</a> 500 (INTERNAL SERVER ERROR)</em><br>
Request:</p>
<p dir="auto"><em>Please help me out friends</em></p>